refactor: reorganize directory structure to match exam submission spec
هذا الالتزام موجود في:
26
q4-scalability/architecture.mmd
Normal file
26
q4-scalability/architecture.mmd
Normal file
@@ -0,0 +1,26 @@
|
||||
```mermaid
|
||||
graph TD
|
||||
Client((Client Requests <br> 15,000 req/s)) --> WAF[Web Application Firewall]
|
||||
WAF --> LB[ghaymah Load Balancer]
|
||||
|
||||
subgraph Auto-Scaling Group
|
||||
direction LR
|
||||
LB -->|Traffic Distribution| API1[myapp-api Container 1 <br> ~350 req/s]
|
||||
LB --> API2[myapp-api Container 2 <br> ~350 req/s]
|
||||
LB --> API3[myapp-api Container 3]
|
||||
LB -.-> APIN[myapp-api Container N <br> Total: 43 Containers]
|
||||
end
|
||||
|
||||
API1 --> BS1[(ghaymah Block Storage <br> /mnt/data)]
|
||||
API2 --> BS2[(ghaymah Block Storage <br> /mnt/data)]
|
||||
API3 --> BS3[(ghaymah Block Storage <br> /mnt/data)]
|
||||
APIN --> BSN[(ghaymah Block Storage <br> /mnt/data)]
|
||||
|
||||
classDef container fill:#e3f2fd,stroke:#1565c0,stroke-width:2px;
|
||||
classDef lb fill:#fff3e0,stroke:#e65100,stroke-width:2px;
|
||||
classDef storage fill:#e8f5e9,stroke:#2e7d32,stroke-width:2px;
|
||||
|
||||
class API1,API2,API3,APIN container;
|
||||
class LB lb;
|
||||
class BS1,BS2,BS3,BSN storage;
|
||||
```
|
||||
0
q4-scalability/architecture.png
Normal file
0
q4-scalability/architecture.png
Normal file
24
q4-scalability/calculations.md
Normal file
24
q4-scalability/calculations.md
Normal file
@@ -0,0 +1,24 @@
|
||||
# Capacity Planning: Handling 15,000 req/s
|
||||
|
||||
To ensure high availability and responsiveness under a load of 15,000 requests per second, we must calculate the required number of container instances.
|
||||
|
||||
## Base Assumptions
|
||||
- **Target Load:** 15,000 req/s
|
||||
- **Max Capacity per Container:** 500 req/s
|
||||
- **Safety Margin:** 30%
|
||||
|
||||
## Calculation
|
||||
1. **Effective Capacity per Container:**
|
||||
To maintain a 30% margin, we calculate the effective capacity each container should handle before we consider scaling out.
|
||||
`500 req/s * (1 - 0.30) = 350 req/s`
|
||||
|
||||
2. **Total Containers Required:**
|
||||
Divide the total expected load by the effective capacity per container.
|
||||
`15,000 req/s / 350 req/s per container ≈ 42.85`
|
||||
|
||||
3. **Rounding Up:**
|
||||
We cannot have a fraction of a container, so we always round up to the next whole number.
|
||||
`ceil(42.85) = 43 containers`
|
||||
|
||||
## Conclusion
|
||||
To safely handle 15,000 req/s while maintaining a 30% safety margin (which helps absorb sudden traffic spikes or the failure of a few containers), the auto-scaling group should be configured to maintain a baseline of **43 containers** during peak load.
|
||||
المرجع في مشكلة جديدة
حظر مستخدم