Overview
High availability (HA) ensures LiteLLM remains operational during:- Infrastructure failures
- Network outages
- Database issues
- Provider API failures
- Traffic spikes
- Uptime: 99.9% (8.76 hours downtime/year)
- Latency: P95 < 5 seconds
- Error rate: < 0.1%
Architecture Patterns
Single Region HA
- Zone-level fault tolerance
- Lower latency within region
- Simpler to manage
- No region-level DR
- Higher latency for distant users
Multi-Region Active-Passive
- Region-level DR
- Lower cost (standby minimal)
- Simple failover
- Manual failover may be required
- RTO: 2-5 minutes
- RPO: 30-60 seconds
Multi-Region Active-Active
- Global low latency
- No single point of failure
- Automatic failover
- RTO: 0 (instant)
- RPO: 0 (no data loss)
- Higher cost
- Complex data consistency
- Requires conflict resolution
Load Balancing
Application Load Balancer (ALB)
- AWS
- GCP
- Kubernetes Ingress
Routing Strategies
Round Robin (default):Database High Availability
PostgreSQL Replication
- AWS RDS
- GCP Cloud SQL
- Self-Managed (Patroni)
Connection Pooling
PgBouncer for connection pooling:pgbouncer.ini
docker-compose.yml
Redis High Availability
Redis Sentinel
docker-compose.yml
config.yaml
Redis Cluster
For higher throughput:Provider Failover
Multi-Provider Configuration
config.yaml
Retry Logic
config.yaml
Autoscaling
Kubernetes HPA
hpa.yaml
KEDA (Advanced)
keda-scaler.yaml
Disaster Recovery
Backup Strategy
Database backups:- Automated (AWS RDS)
- pg_dump
Recovery Procedures
Database recovery:Monitoring and Alerting
Critical Alerts
prometheus-alerts.yml
Testing HA Setup
Chaos Engineering
Simulate failures:chaos-experiment.yaml
Disaster Recovery Drills
Monthly DR drill checklist:1
Simulate Primary Region Failure
2
Verify Automatic Failover
- Monitor traffic shifts to standby
- Check error rates remain < 1%
- Verify latency increases < 100ms
3
Test Database Failover
4
Validate Application
5
Document Results
- RTO achieved
- RPO achieved
- Issues encountered
- Action items
6
Restore Primary
Best Practices Summary
1
Design for Failure
- Assume everything will fail
- No single points of failure
- Multiple availability zones/regions
- Redundant components
2
Automate Recovery
- Health checks at all levels
- Automatic failover
- Self-healing systems
- Circuit breakers
3
Monitor Everything
- Comprehensive metrics
- Proactive alerting
- Distributed tracing
- Regular testing
4
Practice DR
- Monthly DR drills
- Documented runbooks
- Automated testing
- Post-mortem analysis
Next Steps
Monitoring
Set up comprehensive monitoring for HA
Performance
Optimize performance at scale
Security
Secure your HA deployment
Troubleshooting
Debug HA-specific issues