A simple Load Balancer implementation in Go, built from scratch to understand the core concepts behind load balancing and TCP proxying.
- TCP Load Balancer
- Round Robin
- Weighted Round Robin
- Least Connections
- Multiple backend servers
- Concurrent client connections
- Bidirectional TCP forwarding
- Basic backend health state
Client
|
v
Load Balancer :9090
|
+---- Backend 1 :8081
|
+---- Backend 2 :8082
|
+---- Backend 3 :8083
The load balancer accepts client connections, selects a backend using the configured strategy, and forwards traffic between the client and backend.
Currently implemented:
- Round Robin
- Weighted Round Robin
- Least Connections
Planned:
- Consistent Hashing
- Health Checks / Backend Failure Detection
- Graceful Backend Recovery
This project is primarily a learning project to understand how load balancers work internally, including:
- Scheduling algorithms
- TCP connections and streams
- Concurrent connections
- Goroutines and synchronization
- Backend health
- Connection lifecycle
- Consistent hashing
Built from scratch in Go.