1.1 KiB
1.1 KiB
Scalability and Load Balancing
1. Required Number of Containers
Given
- Incoming traffic = 15,000 requests/second
- One container can handle = 500 requests/second
- Safety margin = 30%
Calculation
Required containers without margin:
15000 ÷ 500 = 30 containers
Adding a 30% safety margin:
30 × 1.30 = 39 containers
Rounded up:
40 containers
2. Cold Start Strategy
To reduce startup delays during traffic spikes, the following strategy is recommended:
- Keep at least 2 containers always running.
- Enable Horizontal Pod Autoscaler (HPA).
- Cache container images on cluster nodes.
- Use lightweight Docker images.
- Configure Readiness Probes before sending traffic to new containers.
- Scale gradually to avoid resource spikes.
3. Using Ghaymah Block Storage
Ghaymah Block Storage should be used for stateful workloads that require persistent storage.
Examples include:
- PostgreSQL
- MySQL
- MongoDB
Benefits:
- Data persists even if a container restarts.
- High reliability.
- Easy storage expansion.
- Suitable for production databases.