Null
هذا الالتزام موجود في:
62
q4-scalability/calculations.md
Normal file
62
q4-scalability/calculations.md
Normal file
@@ -0,0 +1,62 @@
|
||||
# Q4 - Scalability & Load Balancing
|
||||
|
||||
## 1. Architecture
|
||||
|
||||
See `architecture.png`.
|
||||
|
||||
---
|
||||
|
||||
## 2. Container Calculation
|
||||
|
||||
### Given
|
||||
|
||||
- Required traffic = **15,000 requests/second**
|
||||
- One container capacity = **500 requests/second**
|
||||
- Safety margin = **30%**
|
||||
|
||||
### Effective Capacity
|
||||
|
||||
Effective capacity per container:
|
||||
|
||||
500 × 70% = **350 requests/second**
|
||||
|
||||
### Required Containers
|
||||
|
||||
15000 ÷ 350 = **42.86**
|
||||
|
||||
Rounded up:
|
||||
|
||||
**43 Containers**
|
||||
|
||||
---
|
||||
|
||||
## 3. Cold Start Strategy
|
||||
|
||||
To reduce startup latency:
|
||||
|
||||
- Keep 2–3 warm containers running.
|
||||
- Enable Auto Scaling when CPU > 70%.
|
||||
- Pre-pull Docker images on worker nodes.
|
||||
- Use Readiness and Liveness probes.
|
||||
- Register new containers with the Load Balancer only after passing health checks.
|
||||
|
||||
---
|
||||
|
||||
## 4. Ghaymah Block Storage
|
||||
|
||||
Ghaymah Block Storage provides persistent storage for stateful workloads.
|
||||
|
||||
Examples:
|
||||
|
||||
- PostgreSQL
|
||||
- MySQL
|
||||
- MongoDB
|
||||
- Redis persistence
|
||||
- User uploaded files
|
||||
|
||||
Benefits:
|
||||
|
||||
- Persistent storage after container restart.
|
||||
- High availability.
|
||||
- Supports snapshots and backups.
|
||||
- Suitable for databases and stateful applications.
|
||||
المرجع في مشكلة جديدة
حظر مستخدم