A simple round-robin load balancer written in Go that proxies HTTP requests across multiple backend NGINX servers using Docker Compose.
- 🧠 Go – Custom load balancer using
httputil.ReverseProxy
- 🌐 NGINX – Lightweight HTTP servers as backends
- 🐳 Docker Compose – Orchestration of all services
┌────────────┐
│ Client │
└────┬───────┘
│
┌──────▼────────┐
│ Go LoadBalancer│
└────┬────┬─────┘
│ │
┌────────▼┐ ┌─▼────────┐
│ NGINX 1 │ │ NGINX 2 │
└─────────┘ └──────────┘
Each request is forwarded to the next NGINX container in a round-robin fashion.
git clone https://github.com/PranavTrip/Go-Load-Balancer.git
cd Go-Load-Balancer
nginx1/index.html # "Hello from Server 1"
nginx2/index.html # "Hello from Server 2"
nginx3/index.html # "Hello from Server 3"
mkdir -p nginx1 nginx2 nginx3
echo "<h1>Hello from Server 1</h1>" > nginx1/index.html
echo "<h1>Hello from Server 2</h1>" > nginx2/index.html
echo "<h1>Hello from Server 3</h1>" > nginx3/index.html
docker-compose up --build