diff --git a/q4-scalability/architecturee.png b/q4-scalability/architecturee.png new file mode 100644 index 0000000..76b84da Binary files /dev/null and b/q4-scalability/architecturee.png differ diff --git a/q4-scalability/calculations.md b/q4-scalability/calculations.md index e69de29..1bf0e3e 100644 --- a/q4-scalability/calculations.md +++ b/q4-scalability/calculations.md @@ -0,0 +1,55 @@ +# 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.