Hermes is a simple yet powerful HTTP load balancer and reverse proxy written from scratch in Go. It’s designed to optimize your network’s load distribution, ensuring smooth and reliable service delivery.
Key Features
- HTTP load balancing and reverse proxy functionality
- Multiple load distribution strategies
- Active and passive health checks for backend services
- Easy configuration via YAML file or command-line arguments
- Docker support for simple deployment
Load Distribution Strategies
Hermes supports multiple strategies to cater to different needs:
- Round Robin: A fair and equal distribution method, perfect for when all backend services have similar processing capabilities.
- Weighted Round Robin: Tailor the load distribution based on the processing power of each backend, assigning more weight to stronger servers.
- Least Connections: Smartly routes traffic to the servers with the fewest active connections, minimizing response times and maximizing efficiency.
Health Checks
Hermes ensures high availability through two types of health checks:
- Active Checks: During request processing, if a selected backend is unresponsive, it’s immediately marked as down.
- Passive Checks: Regular pings are sent to backends at fixed intervals to monitor their status.
Configuration
Hermes can be configured using a YAML file:
port: 80 # Port on which the load balancer will be running
healthCheckInSec: 20 # Interval for passive health checks in seconds
strategy: "least-connections" # Load balancing strategy
services: # Backend services configuration
- name: srv1
url: http://localhost:9001
weight: 30
- name: srv2
url: http://localhost:9002
weight: 1
- name: srv3
url: http://localhost:9003
weight: 1
Running Hermes
Getting started with Hermes is straightforward:
# Using a configuration file
./hermes
# Using command-line arguments
./hermes --help
# Running with Docker Compose
docker compose up
Hermes was built to balance simplicity with power - offering robust load distribution capabilities while remaining easy to configure and deploy.