This project implements a dynamic load balancer using Node.js and Express. It distributes incoming HTTP requests across multiple backend servers, performs health checks, and implements self-healing capabilities.
- Dynamic server pool management
- Multiple load balancing algorithms (Round Robin, Weighted Round Robin)
- Periodic health checks
- Self-healing attempts for failed servers
- Configurable retry logic
- Alert system for server failures
- Rate limiting
- Sticky sessions
- Caching
- Content-based routing
- Geo-routing
- Latency-based routing
- SSL/TLS support
- Multi-region support
- Circuit breaker pattern
- WebSocket support
- CORS configuration
- Request/Response compression
- IP whitelisting and blacklisting
- Request/Response transformation
- API key authentication
- Monitoring endpoints
- Dynamic configuration reloading
- Graceful shutdown
- Node.js (v14 or later recommended)
- npm (comes with Node.js)
- Clone the repository:
git clone https://github.com/ItsRoy69/Load-Balancer.git
cd dynamic-load-balancer
- Install dependencies:
npm install
- Configure the load balancer by creating a
.env
file based on the provided sample.
Configuration Create a .env file in the root directory and configure.
- Start the backend servers:
node src/backend-server.js 8081
node src/backend-server.js 8082
node src/backend-server.js 8083
- Start the load balancer:
node src/load-balancer.js
- The load balancer will start on the configured port (default 80).
You can test the load balancer by sending HTTP requests to its address. The /health
endpoint can be used to check the load balancer's status.
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the Apache License - see the LICENSE file for details.