# Q4: Scalability Sizing Calculations & Strategy --- ## 1. Container Capacity Calculation (Sizing) - **Total Incoming Traffic:** $15,000 \text{ req/s}$ - **Single Container Capacity:** $500 \text{ req/s}$ - **Base Containers Required:** $$\frac{15,000}{500} = 30 \text{ containers}$$ - **Safety Margin (30% buffer for traffic spikes & high availability):** $$30 \times 0.30 = 9 \text{ extra containers}$$ - **Total Containers Needed:** $$30 + 9 = 39 \text{ containers}$$ --- ## 2. Cold Start Mitigation Strategy To minimize latency and prevent performance drops when new containers spin up rapidly during auto-scaling: - **Pre-warmed / Min Replicas:** Maintain a baseline of idle warm containers ready to take traffic immediately. - **Lightweight Container Images:** Optimize the Dockerfile (using multi-stage builds and slim base images) to reduce image pull and startup time. - **Health Check Optimization:** Tune liveness probes to detect readiness faster without overloading the container during boot. --- ## 3. Ghaymah Block Storage for Stateful Workloads - **The Problem:** Containers are inherently ephemeral (stateless)—any data written inside the container's internal file system is lost if the container crashes or restarts. - **The Solution (Ghaymah Block Storage):** - Provides high-performance, persistent network-attached storage volumes. - By mounting a Ghaymah Block Storage volume to the stateful workload (e.g., databases or file uploads), data is decoupled from the container lifecycle. - If a container dies, a new container spins up and attaches to the exact same persistent storage volume with zero data loss.