Unit 5 of 15 · about 4 hours · derive, implement
Capacity headroom, failure reserve, overload detection and load shedding
Capacity is the difference between a failure you survive and one you join. Headroom arithmetic plus early shedding keeps one slow dependency from queueing the whole system.
You'll be able to
- Derive headroom and failure reserve from workload, replication and recovery costs.
- Detect overload from queue, latency and saturation signals and shed load early with explicit rejection.
- Bound every queue so overload produces backpressure or drops, never unbounded growth.
Covers
Read
In this order, only the parts listed
0 of 3 done
- Handling overload: limits and client-side throttlingGoogle SRE Books - SLOs, Monitoring, Overload, Cascades, Incidents and Recovery
Per-Customer Limits; Client-Side Throttling (Client request rejection probability); Criticality; Utilization Signals; Deciding to Retry
Read for the throttle-at-the-client argument. Leave datacenter-scale load balancing as background.
- Degradation: tiering, shedding, kill switchesHLD Handbook - Reliability, Operations and Security at Scale
Critical-path tiering; Load shedding; Feature flags as kill switches; Cached and static fallbacks
- Capacity: planning math and scaling lagHLD Handbook - Reliability, Operations and Security at Scale
Picking the right signal; Scaling lag: the hidden enemy; Capacity planning math; The dependencies that do not scale
Read for the math and the lag warning. Skip the Kubernetes autoscaling family and the Netflix case study unless your dossier runs there.
Focus on
- Headroom is derived, not chosen. Three equal nodes that must survive one failure sustain at most two thirds of total capacity, because each survivor absorbs half the load.
- Shed at the client before queues build at the server. Server-side queues hide overload until every layer is full at once.
- The Systems unit on Little's Law, capacity and queueing approximations taught for stable long-run averages; it does not bound individual waits. Bound queue length to cap backlog, and bound service delay or enforce deadlines to bound waiting time.
- Autoscaling lags the spike. The scaling-lag section is why a provisioned reserve, not a scaling policy, covers the first minutes.
Common mistakes · 3
- Reading raw capacity as throughput. A database with 5000 work units per second serves only 2500 requests per second at 2 units each; divide capacity by per-request work and take the smallest ratio.
- Draining before admitting. The buffer simulator admits arrivals first and drains second each interval; reversing the order understates the peak backlog.
- Carrying drain capacity across intervals. Unused drain does not roll over, so idle intervals do not bank future capacity.
Try it yourself
Closed-book, before checking anything
Quiz yourself
Answer first, then mark it. Missed ones go to Review.
0 got · 0 missed
1.Three equal nodes of capacity each must keep serving total load after any one node fails. What is the bound on ?Answer
Each survivor takes , so and : two thirds of the total.
2.API, database and cache capacities are 12000, 5000 and 20000 work units per second, with 1, 2 and 0.5 units per request. What is the throughput bound and which component is the bottleneck?Answer
The ratios are 12000, 2500 and 40000 requests per second, so the bound is 2500, set by the database at . Every request uses every component, so the minimum ratio wins.
3.Why does client-side throttling beat server-side queueing during overload?Answer
Rejected work at the client never consumes server queues, threads or downstream calls. Server queues only delay the same reckoning while sharing fate across callers.
4.A buffer of capacity 5 holds 2 events. Interval arrivals are 8 with drain 3. How many are dropped, and what remains?Answer
3 fit, so 5 are dropped. Draining 3 of the 5 buffered leaves 2. Arrivals are admitted before draining, and drops are counted per interval.
Practice
- AlgoMaster: Analyze Capacity Bottlenecks
maxThroughputis the minimum capacity-per-work ratio within 1e-5;bottleneckbreaks exact ties alphabeticallyThe section mini-project covers this: derive capacity separately for foreground requests, replication fan-out, backup, restore and repair, reserve each shared resource for a stated concurrent recovery workload, then compare the predicted bottleneck with an injected node-loss run.
- AlgoMaster: Simulate Log Pipeline Backpressure
Per interval admit-then-drain order with no drain carryover; the pages test backlog consumption of buffer space
You're done when
Your three-node bound, bottleneck arithmetic and one buffer trace all match hand computation, your resource ledger reserves capacity for the stated recovery workload, and your loglab queues reject explicitly past their bounds.
Only when you can do this without notes.
Leads to
Notes
Resources · 2 for this unit, 15 more in the section
- HLD Handbook - Reliability, Operations and Security at ScaleHLD Handbook · primary
Read Part 6 observability, SLOs, resilience, overload, deployments, chaos, incidents and health, then Part 7 authentication, mTLS, secrets, tenancy and data governance chapters relevant to the capstone. Skip unrelated case studies.
- Google SRE Books - SLOs, Monitoring, Overload, Cascades, Incidents and RecoveryGoogle · required
Read SRE Chapter 4 (service level objectives), 6 (monitoring distributed systems), 21 (handling overload), 22 (addressing cascading failures), 14 (managing incidents) and 15 (postmortem culture); Workbook Chapter 2 (implementing SLOs) and 5 (alerting on SLOs); and Building Secure and Reliable Systems Chapter 5 (least privilege) and 9 (design for recovery). Convert each into one alert, limit, load test or runbook action in the capstone.
Also in this section
- DDIA 2e - Chapters 2, 5 and 14Martin Kleppmann and Chris Riccomini · support
Use Chapter 2 "Describing Performance" for percentile and response-time vocabulary and Chapter 5 for compatibility during rolling upgrades. Chapter 14 is about predictive analytics, privacy and data governance, not operations: read its "Privacy and Tracking" section for the retention and deletion units.
- Metastable Failures in Distributed Systems (Bronson et al., 2021)HotOS · support
Read the trigger and sustaining-effect model of metastable failure and the retry and shedding design prompts. Its model illustrates; it does not predict.
- Metastable Failures in the Wild (Huang et al., 2022)USENIX OSDI · support
Read the incident study for how retries and load sustain outages after the trigger ends; it is a sample of public reports, not a rate.
- Simple Testing Can Prevent Most Critical Failures (Yuan et al., 2014)USENIX OSDI · support
Read the findings on error-handling code and how few nodes and events reproduce most failures, as the case for testing error paths in your campaign. Its bounds come from one sample of 2014 systems.
- Gray Failure: The Achilles' Heel of Cloud-Scale Systems (Huang et al., 2017)Microsoft Research · support
Read the gray-failure model (differential observability between a detector and its clients) as vocabulary for telemetry and failure detection.
- The Internals of PostgreSQL - Base Backup and Point-in-Time RecoveryHironobu Suzuki · support
Read Chapter 10 (base backup, how PITR replays WAL, timelines and incremental backup) as the real-engine model for backup integrity, recovery points and restore verification. Note the date you read it.
- Building Distributed Systems - The Tracer, The Securitor and The MigratorBuild Distributed Systems · optional
Only the first three tasks of each track are free: in The Tracer, trace-context propagation, span lifecycle and a collector; in The Securitor, JWTs, the OAuth 2 code flow with PKCE and sessions; in The Migrator, schema migrations, expand and contract, and zero-downtime change. Tasks are graded in the browser after login, so treat a pass as a drill and keep your local harness as the evidence.
- SPIFFE Workload Identity and Workload APISPIFFE Project · support
Read the SPIFFE ID, X.509-SVID and trust bundle specifications and the Workload API (
FetchX509SVID,FetchX509Bundles) to design service identity, short-lived credentials and bundle rotation. A local mock is sufficient unless a real SPIRE deployment answers a specific gap. - OpenTelemetry Signals and Semantic ConventionsOpenTelemetry · support
Read signals and context propagation (W3C Trace Context
traceparent, inject and extract, baggage rules), then the semantic conventions (1.44.0) for the RPC and messaging areas with their stability status. Define bounded attributes for request, node, partition, term and offset identities, and never infer global order from display timestamps. - Replicated Log and Stream Processor - Production ContractRoadmap-Final · support
Add workload identity, tenant checks, audit, SLOs, capacity limits, backup and verified restore, mixed-version migration, rollback and reduced point-in-time ML data paths. Run one compound incident from detection through recovery.
- OWASP Threat Modeling Cheat SheetOWASP · reference
Use System Modeling (data-flow diagrams, trust boundaries, stores and processes), Threat Identification (the STRIDE table applied to components, data flows and trust boundaries) and Response and Mitigations to build the unit threat model.
- Feast Documentation - Point-in-Time Joins and Feature RetrievalFeast · support
Read Point-in-time joins (entity dataframes,
get_historical_features, TTL backward scan,filter_by_created_timestamp) and Feature retrieval (event_timestampas the inclusive upper bound,get_online_featureswithout timestamps, feature services per model version, materialize refresh). Work the join logic on tiny local tables; do not deploy Feast. Page read 2026-10-15 (v0.66-branch documentation). - MLflow Model Registry DocsMLflow · support
Read the Model Registry page (registered models, versions, lineage to the producing run, aliases such as @champion, and tags) and the registry tutorial promotion flow. Stages are deprecated since MLflow 2.9; use aliases and tags. Page read 2026-10-15; the versioned docs move, so re-pin the version you read.
- DVC Docs - Data VersioningDVC · support
Read
dvc add(Description and Example: Single file) for.dvccontent-hash sidecars, thedvc.yamlpage with itsdvc.lock filesection for pipeline state, andpushandpullfor transfer. A local directory remote is enough; do not set up cloud storage. Page read 2026-10-15. - PostgreSQL 18 Documentation - Recovery Targets, Backup Verification and RewindPostgreSQL Global Development Group · reference
Read Section 19.5.6 Recovery Target, the
pg_verifybackupreference and thepg_rewindreference for recovery stopping points, manifest checks and rejoining a diverged primary.