A lightweight, fast, and extensible load balancer written in Go.
Loady helps you distribute traffic across multiple backend servers with health checks, hot-reloadable configuration, and support for multiple balancing algorithms (round-robin, least-connections, IP hash, etc.).
- 🔄 Multiple load balancing algorithms (round-robin, least-connections, IP hash, …)
- ❤️ Health checks with automatic failover
- ⚙️ Hot-reloadable configuration (no restart required)
- 🔐 Graceful shutdown & error handling
- 📊 Metrics & logging for monitoring traffic
- 📦 Cross-platform binaries for Linux, macOS, and Windows
go install github.com/adel-hadadi/loady@latestDownload a prebuilt binary from the Releases page.
Example for Linux:
curl -L https://github.com/adel-hadadi/loady/releases/latest/download/loady_linux_amd64 -o loady
chmod +x loady
sudo mv loady /usr/local/bin/Run Loady with a simple config file:
loady --config ./config.yamlNote
Loady can also run without that --config flag but by default its looking for config file in /etc/loady/config.yml.
algorithm: round-robin
servers:
- http://127.0.0.1:8081
- http://127.0.0.1:8082
- http://127.0.0.1:8083
healthcheck:
interval: 5s
timeout: 2s
path: /health- Round Robin – evenly distributes requests
- Least Connections – sends new requests to the server with the fewest active connections
- IP Hash – same client IP always goes to the same backend
Loady continuously probes backend servers and automatically removes unhealthy nodes from the pool. When they recover, they’re added back automatically.
Example log:
[INFO] server 127.0.0.1:8082 is unhealthy
[INFO] server 127.0.0.1:8082 is back online
Loady now integrates with Prometheus to provide real-time metrics about your load balancer and the services it manages. This allows you to monitor the performance and health of your applications easily.
Some of the key metrics Loady exposes:
| Metric | Description |
|---|---|
http_request_duration_seconds |
Duration of HTTP requests handled by Loady. |
http_total_operations_processed |
Total number of requests processed by Loady. |
healthy_servers_count |
Number of servers currently marked as healthy. |
- Run Loady with Prometheus metrics enabled (enabled by default on
/metricsendpoint). - Point your Prometheus server to scrape Loady:
scrape_configs:
- job_name: 'loady'
static_configs:
- targets: [ '<LOADY_HOST>:<METRICS_PORT>' ]- Visualize metrics with Grafana or any other Prometheus-compatible dashboard.
Tip
These metrics help you track response times, detect unhealthy servers quickly, and analyze traffic patterns for better load balancing decisions.
Clone the repo and build:
git clone https://github.com/adel-hadadi/loady.git
cd loady
go build -o loady ./cmdRun tests:
go test ./...- Add sticky sessions
- Prometheus metrics
- gRPC load balancing
- Advanced configuration via API
- More detailed logging
Contributions are welcome! Please open an issue or PR to discuss changes.
MIT License – see LICENSE for details.