Does SSLcat support load balancing?
Yes, SSLcat has powerful built-in load balancing features, supporting multiple load balancing algorithms and intelligent connection pool management.
Load Balancing Algorithms
SSLcat supports various load balancing algorithms:
- Round Robin - Distributes requests to backends in sequence
- Least Connections - Selects the backend with the fewest connections
- IP Hash - Selects a backend based on the client's IP hash
- Weighted Round Robin - Distributes requests based on weights
Basic Configuration
Configure multiple backend servers:
proxies:
- domain: "app.example.com"
targets:
- "http://backend1.example.com:3000"
- "http://backend2.example.com:3000"
- "http://backend3.example.com:3000"
protocol: "http"
load_balance: "round_robin"
Weighted Load Balancing
Set weights for different backends:
proxies:
- domain: "app.example.com"
targets:
- target: "http://backend1.example.com:3000"
weight: 3
- target: "http://backend2.example.com:3000"
weight: 2
- target: "http://backend3.example.com:3000"
weight: 1
protocol: "http"
load_balance: "weighted_round_robin"
Health Checks
Configure backend health checks:
proxies:
- domain: "app.example.com"
targets:
- "http://backend1.example.com:3000"
- "http://backend2.example.com:3000"
- "http://backend3.example.com:3000"
protocol: "http"
load_balance: "least_conn"
health_check:
enabled: true
path: "/health"
interval: 30
timeout: 5
retries: 3
Failover
Configure a failover mechanism:
proxies:
- domain: "app.example.com"
targets:
- "http://primary.example.com:3000"
- "http://backup1.example.com:3000"
- "http://backup2.example.com:3000"
protocol: "http"
load_balance: "round_robin"
failover:
enabled: true
max_failures: 3
recovery_time: 60
Connection Pool Management
Intelligent connection pool configuration:
proxies:
- domain: "app.example.com"
targets:
- "http://backend1.example.com:3000"
- "http://backend2.example.com:3000"
protocol: "http"
load_balance: "round_robin"
connection_pool:
max_connections: 100
max_idle_connections: 10
idle_timeout: 90
keep_alive: true
Session Persistence
Configure session persistence (sticky sessions):
proxies:
- domain: "app.example.com"
targets:
- "http://backend1.example.com:3000"
- "http://backend2.example.com:3000"
protocol: "http"
load_balance: "ip_hash"
session_sticky:
enabled: true
cookie_name: "SSLCAT_SESSION"
cookie_ttl: 3600
Monitoring and Statistics
Load balancing monitoring features:
- Backend Status - Displays the status of each backend
- Connection Statistics - Shows the distribution of connections
- Response Time - Displays the response time of each backend
- Error Rate - Shows the error rate of each backend
Best Practices
Recommendations for load balancing configuration:
- Enable Health Checks - Ensure the availability of backend services
- Set Weights Reasonably - Set weights according to backend performance
- Configure Failover - Improve service availability
- Monitor Performance - Continuously monitor the effectiveness of load balancing
With SSLcat's load balancing features, you can build a high-availability service architecture.