Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 1.79 KB

README.md

File metadata and controls

50 lines (36 loc) · 1.79 KB

API Gateway

Overview

This API Gateway project implements three load balancing strategies: Least Connections, Round Robin, and Weighted Round Robin. It features caching, rate limiting, and health checks to enhance the performance and reliability of backend service requests.

Features

  • Load Balancing: Implemented three strategies:
    • Least Connections
    • Round Robin
    • Weighted Round Robin
  • Caching: Uses Redis for caching responses to improve response times for repeated requests.
  • Rate Limiting: Limits the number of requests to prevent abuse and ensure fair usage.
  • Health Checks: Regularly checks the health of backend services to route requests only to healthy instances.
  • API Forwarding:
    • HTTP Requests: Uses Axios to forward HTTP requests.
    • WebSocket: Handles WebSocket connections for real-time communication.

Screenshots

  • Axios Request Benchmark axios

  • WebSocket Request Benchmark
    websocket

Getting Started

Prerequisites

Before running the API Gateway, you need to start the backend servers.

Step 1: Run Backend Servers

  1. Navigate to the multibackend folder.
  2. Run the backend servers using the following commands:
cd multibackend
cd backend_1 # go to every backend folder backend_1, backend_2, and backend_3
node src/server.js # This will start backend_1, backend_2, and backend_3
cd Gateways
cd 'gateway ws' #GO to one folder gateway apis this is for apis request forwarding or gateway ws this is for websockets request forwarding
npm run dev

After all this send the request to gateway api like normal requests.