الملفات
ghaymah-exam-MostafaBebars-SRE/q4-scalability/calculations.md
2026-07-28 13:34:58 +03:00

1.4 KiB

Container Calculation

Container Capacity Calculation

To handle 15,000 requests per second with a base container capacity of 500 requests per second and a 30% safety margin:

  1. Base Containers Needed: 15,000 / 500 = 30 containers
  2. Safety Buffer (30%): 30 * 0.30 = 9 containers
  3. Total Required Containers: 30 + 9 = 39 containers

Cold Start Mitigation Strategy

To prevent dropped requests or high latency when spinning up new containers:

  1. Pre-warming (Provisioned Concurrency): Maintain a buffer of extra "warm" containers running just above the current traffic demands.
  2. Health & Readiness Probes: Ensure the load balancer only routes traffic to containers that have passed their readiness checks and are fully booted.
  3. Image Optimization: Keep Docker images small (e.g., using Alpine Linux) so Ghaymah can pull and extract the image rapidly.

Using Ghaymah Block Storage for Stateful Workloads

Because containers are ephemeral, stateful workloads (like databases) lose data if a container crashes. Ghaymah Block Storage solves this:

  1. Provision & Mount: A persistent block storage volume is provisioned and mounted to a specific directory path inside the container
  2. Persistence: The application writes data directly to this external volume. If the container is destroyed or rescheduled, the volume easily reattaches to the new container, ensuring zero data loss.