Overview
Gate is designed to scale horizontally, allowing you to handle thousands of concurrent players by adding more proxy instances. This guide covers autoscaling strategies and load balancing configurations.Horizontal Pod Autoscaling
Prerequisites
Ensure the Metrics Server is installed:CPU-Based Autoscaling
Create an HPA based on CPU utilization:Memory-Based Autoscaling
Scale based on memory usage:Combined Metrics
Scale based on multiple metrics:Custom Metrics
Using Prometheus Adapter
Scale based on custom metrics like active player count: Install Prometheus and the adapter:Load Balancing Strategies
NodePort Service
Basic load balancing using NodePort:NodePort exposes the service on each node’s IP at a static port. Use this for testing or when you have external load balancing.
LoadBalancer Service
Cloud provider load balancer:Cloud-Specific Configurations
AWS Network Load Balancer
Google Cloud Load Balancer
Azure Load Balancer
Pod Disruption Budget
Ensure high availability during maintenance:Pod Anti-Affinity
Distribute pods across nodes for better resilience:Topology Spread Constraints
Modern alternative to pod anti-affinity:Monitoring Scaling
View HPA Status
Metrics
Performance Tuning
Resource Requests and Limits
Set appropriate resource requests for autoscaling:Quality of Service (QoS)
Ensure Guaranteed QoS for stable performance:Scaling Best Practices
1
Start Conservative
Begin with 2-3 replicas and adjust based on actual load patterns.
2
Monitor Metrics
Track CPU, memory, and player count metrics over time.
3
Set Appropriate Thresholds
Target 60-70% CPU utilization for optimal scaling headroom.
4
Configure Session Affinity
Use ClientIP session affinity to keep players on the same proxy.
5
Implement PDB
Ensure minimum availability during node maintenance.
6
Test Scaling
Simulate load to verify autoscaling behavior before production.
Production Scaling Example
Complete production-ready configuration:Troubleshooting
HPA Not Scaling
Uneven Load Distribution
- Verify session affinity is configured
- Check external traffic policy setting
- Review pod anti-affinity rules
- Examine load balancer configuration
Pods Not Scaling Down
- Check stabilization window settings
- Review PDB configuration
- Verify scale-down policies
- Check for active player connections
Next Steps
Monitoring
Set up monitoring and alerting
Configuration
Advanced configuration options

