Overview
LightYear Managed Load Balancers distribute incoming traffic across a pool of backend servers, providing high availability and horizontal scaling.
Step 1 — Create a Load Balancer
- Navigate to Network → Load Balancers → Create.
- Choose a region (must match your backend servers).
- Select a forwarding rule:
- Frontend: TCP/443 (HTTPS)
- Backend: TCP/80 (HTTP)
- Add backend servers by IP or server ID.
- Configure health checks.
Health Check Configuration
| Setting | Recommended Value |
|---|---|
| Protocol | HTTP |
| Path | /health |
| Interval | 10 seconds |
| Timeout | 5 seconds |
| Healthy threshold | 2 |
| Unhealthy threshold | 3 |
SSL Termination
Upload your SSL certificate under Load Balancer → SSL Certificates:
$# Generate a self-signed cert for testing$openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout server.key -out server.crt -subj "/CN=example.com"For production, use Let's Encrypt or upload your CA-signed certificate.
Sticky Sessions
Enable sticky sessions to route a client's requests to the same backend:
- Cookie-based — LB injects a cookie; best for stateful apps
- IP-based — Routes by client IP; simpler but less reliable with NAT
Backend Health Monitoring
$# Check backend status via API$curl -H "Authorization: Bearer <API_KEY>" https://api.lightyear.host/v1/load-balancers/<LB_ID>/backendsPricing
| Component | Cost |
|---|---|
| Load Balancer | $0.015/hr (~$10.95/month) |
| Bandwidth | First 10 TB free, then $0.01/GB |
