Complete Q4
هذا الالتزام موجود في:
ثنائية
q4-scalability/architecture.png
Normal file
ثنائية
q4-scalability/architecture.png
Normal file
ملف ثنائي غير معروض.
|
بعد العرض: | الارتفاع: | الحجم: 44 KiB |
@@ -1,55 +1,58 @@
|
|||||||
# Scalability and Load Balancing
|
# Q4 - Scalability and Load Balancing
|
||||||
|
|
||||||
## 1. Required Number of Containers
|
## 1. Architecture Overview
|
||||||
|
|
||||||
### Given
|
The application is deployed behind a Load Balancer that distributes incoming traffic across multiple application containers.
|
||||||
|
|
||||||
- Incoming traffic = **15,000 requests/second**
|
Components:
|
||||||
- One container can handle = **500 requests/second**
|
|
||||||
- Safety margin = **30%**
|
|
||||||
|
|
||||||
### Calculation
|
- Users
|
||||||
|
- Load Balancer
|
||||||
Required containers without margin:
|
- Container Cluster
|
||||||
|
- Ghaymah Block Storage
|
||||||
15000 ÷ 500 = **30 containers**
|
- Database
|
||||||
|
|
||||||
Adding a 30% safety margin:
|
|
||||||
|
|
||||||
30 × 1.30 = **39 containers**
|
|
||||||
|
|
||||||
Rounded up:
|
|
||||||
|
|
||||||
**40 containers**
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 2. Cold Start Strategy
|
## 2. Required Number of Containers
|
||||||
|
|
||||||
To reduce startup delays during traffic spikes, the following strategy is recommended:
|
Application Load = 15,000 requests/second
|
||||||
|
|
||||||
- Keep at least 2 containers always running.
|
One Container Capacity = 500 requests/second
|
||||||
- Enable Horizontal Pod Autoscaler (HPA).
|
|
||||||
- Cache container images on cluster nodes.
|
Required Containers:
|
||||||
- Use lightweight Docker images.
|
|
||||||
- Configure Readiness Probes before sending traffic to new containers.
|
15000 / 500 = 30 Containers
|
||||||
- Scale gradually to avoid resource spikes.
|
|
||||||
|
Safety Margin (30%):
|
||||||
|
|
||||||
|
30 × 1.30 = 39 Containers
|
||||||
|
|
||||||
|
Final Answer:
|
||||||
|
|
||||||
|
**39 Containers**
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## 3. Using Ghaymah Block Storage
|
## 3. Cold Start Strategy
|
||||||
|
|
||||||
Ghaymah Block Storage should be used for stateful workloads that require persistent storage.
|
To reduce cold start latency:
|
||||||
|
|
||||||
Examples include:
|
- Keep a small number of warm containers running.
|
||||||
|
- Enable Auto Scaling based on CPU and request rate.
|
||||||
|
- Perform health checks before routing traffic.
|
||||||
|
- Register new containers with the Load Balancer only after becoming healthy.
|
||||||
|
- Use lightweight container images for faster startup.
|
||||||
|
|
||||||
- PostgreSQL
|
---
|
||||||
- MySQL
|
|
||||||
- MongoDB
|
## 4. Ghaymah Block Storage
|
||||||
|
|
||||||
|
Block Storage is used for stateful workloads such as databases.
|
||||||
|
|
||||||
Benefits:
|
Benefits:
|
||||||
|
|
||||||
- Data persists even if a container restarts.
|
- Data persists even if containers restart.
|
||||||
- High reliability.
|
- Supports high availability.
|
||||||
- Easy storage expansion.
|
- Can be attached to replacement containers.
|
||||||
- Suitable for production databases.
|
- Suitable for MySQL, PostgreSQL, MongoDB and other databases.
|
||||||
|
|||||||
المرجع في مشكلة جديدة
حظر مستخدم