teluzia.Cloud Engineer · Day 141
CHAPTER 21 · CLOUD SYSTEM DESIGN

Scalability and availability patterns

4–5 hours including independent practice3 topics
LET’S MAKE THIS SIMPLE

What you’re learning today

Scalability is today's starting point. Each worker handles 50 requests/second, so four workers offer an approximate 200 before shared limits. A database capped at 120 writes/second remains the bottleneck even after eight workers are added. You will connect this with availability and overload protection. The lesson's artifact brings these decisions together: Draw a two-zone API design with one database bottleneck; calculate per-worker capacity and describe admission control during overload.

Think of it this way

Scaling a restaurant adds cooks, but one oven can remain the bottleneck; availability also needs a plan for an unavailable kitchen.

TOPIC 01 / 03Step by step

Scalability

Horizontal scaling adds workers while vertical scaling changes resource size. Identify the limiting resource and load pattern; adding web replicas cannot repair a saturated single database. Each worker handles 50 requests/second, so four workers offer an approximate 200 before shared limits. A database capped at 120 writes/second remains the bottleneck even after eight workers are added.

WORKED EXAMPLE
Each worker handles 50 requests/second, so four workers offer an approximate 200 before shared limits. A database capped at 120 writes/second remains the bottleneck even after eight workers are added.

Throughput is completed work per time unit; vertical scaling increases one node's capacity; horizontal scaling adds nodes. Imagine a stateless API has many parallel reads but each request acquires a single global lock. More replicas may add contention rather than proportional throughput. Measure the request path and identify whether CPU, I/O, a lock or a downstream quota limits completion. Estimate per-worker capacity under the same workload and verify that a scale-out experiment preserves correctness. A load balancer distributes work but does not eliminate shared bottlenecks. Horizontal growth improves independent worker capacity and failure isolation, while adding coordination and deployment complexity. Choose the change that targets the measured limiting mechanism, and define the next bottleneck expected after it improves. Reestimate shared-resource limits after scaling.

Why this matters

A database capped at 120 writes/second remains the bottleneck even after eight workers are added.

A common trap

Adding web replicas always fixes a saturated database.

Read all topics in this lesson

A complete reference to revisit alongside the guided steps above.

Scalability

Horizontal scaling adds workers while vertical scaling changes resource size. Identify the limiting resource and load pattern; adding web replicas cannot repair a saturated single database. Each worker handles 50 requests/second, so four workers offer an approximate 200 before shared limits. A database capped at 120 writes/second remains the bottleneck even after eight workers are added.

WORKED EXAMPLE
Each worker handles 50 requests/second, so four workers offer an approximate 200 before shared limits. A database capped at 120 writes/second remains the bottleneck even after eight workers are added.

Throughput is completed work per time unit; vertical scaling increases one node's capacity; horizontal scaling adds nodes. Imagine a stateless API has many parallel reads but each request acquires a single global lock. More replicas may add contention rather than proportional throughput. Measure the request path and identify whether CPU, I/O, a lock or a downstream quota limits completion. Estimate per-worker capacity under the same workload and verify that a scale-out experiment preserves correctness. A load balancer distributes work but does not eliminate shared bottlenecks. Horizontal growth improves independent worker capacity and failure isolation, while adding coordination and deployment complexity. Choose the change that targets the measured limiting mechanism, and define the next bottleneck expected after it improves. Reestimate shared-resource limits after scaling.

Why this matters

A database capped at 120 writes/second remains the bottleneck even after eight workers are added.

A common trap

Adding web replicas always fixes a saturated database.

Availability

Spread replicas across failure domains and use health checks. Redundancy only helps when dependencies and routing survive the same failure; count shared components explicitly. Two web replicas in separate zones can survive one zone loss only if load balancing and database access remain available. A single database in the failed zone defeats the web-tier redundancy.

WORKED EXAMPLE
Two web replicas in separate zones can survive one zone loss only if load balancing and database access remain available. A single database in the failed zone defeats the web-tier redundancy.

A failure domain is a group likely to fail together; redundancy supplies alternatives; a health check influences which alternatives receive traffic. Imagine replicas run in two zones but share one credential service and one database endpoint. A zone diagram alone omits those shared failure points. Trace every dependency needed for a successful request and decide what happens if each becomes unavailable. Health checks should exclude unusable replicas without causing synchronized restart loops. Capacity must remain sufficient after the planned failure, not merely during normal operation. Additional replicas and zones improve resilience but increase coordination and cost. State the failure model the architecture supports and the recovery behavior for conditions beyond it, rather than claiming that redundancy makes downtime impossible. Recheck post-failure capacity explicitly.

Why this matters

A single database in the failed zone defeats the web-tier redundancy.

A common trap

Two replicas sharing one failed dependency guarantee availability.

Overload protection

Bound concurrency and queues, reject excessive work and choose retry budgets. Unlimited retries amplify overload and can keep a recovered dependency unhealthy. When arrivals are 300/second and processing is 200/second, backlog grows by 100/second. Bound the queue and reject excess work; retries should use backoff and a finite budget.

WORKED EXAMPLE
When arrivals are 300/second and processing is 200/second, backlog grows by 100/second. Bound the queue and reject excess work; retries should use backoff and a finite budget.

Admission control limits incoming work; backpressure signals limited downstream capacity; a retry budget bounds repeated attempts. Imagine clients immediately retry every failed request while workers are already saturated. The retry traffic competes with new requests and can prolong the incident. Bound concurrent work, return an explicit overload response where appropriate and use jittered backoff for supported retries. Queues should have capacity and age limits so they do not become an invisible store of expired requests. Preserve idempotency when retrying business operations. Rejecting excess work sacrifices some short-term availability but protects healthy capacity and recovery. Decide which requests can wait, which can fail fast and how clients learn that distinction, then test the policy under a controlled burst. Count exhausted retries separately from successes.

Why this matters

Bound the queue and reject excess work; retries should use backoff and a finite budget.

A common trap

Unlimited immediate retries reduce pressure during an overload.

KEEP THESE WITH YOU

Today’s takeaways

Scalability: Horizontal scaling adds workers while vertical scaling changes resource size.

Availability: Spread replicas across failure domains and use health checks.

Overload protection: Bound concurrency and queues, reject excessive work and choose retry budgets.

CLOSE THE LOOP

Ready to complete this day?

Verify the practical steps and pass the knowledge check (at least two thirds correct).

Lab steps verifiedKnowledge check passed