7 routes42 sections324 units

Unit 6.5 · about 3 h

278 / 324

Queue bounds, first saturation and open-loop load

Capacity math predicts; load proves. Assumed background: the Programming profiling-benchmarking unit, which measured one client at a time. This unit drives offered load on a schedule, which is the only way to see queueing before users do.

  • measure

You can now

  • Run an open-loop generator and a closed-loop driver against the same slow server and explain the different latency pictures.
  • Find the first saturation point of your service and name the bottleneck that migrates as load rises.
  • Retain raw load records and report percentiles from samples with n.

Covers

  • Queue bounds, first saturation point and bottleneck migration
  • Open-loop load and coordinated-omission vocabulary

Study, in this order

3 steps

  1. Coordinated omission and latency correction
    Gil Tene - How NOT to Measure Latency (talk)

    Full talk: closed-loop testers that wait for each reply, missing samples under queueing, and the correction concept of recording intended send time

    Depth · Watch for the vocabulary and the correction idea. Do not adopt wrk, hey or ab; write the small Python generator in Reproduce instead.

  2. Load, autoscaling and the shedding case study
    Google SRE Workbook - SLO, load, incident and canary exercises

    Autoscaling (Handling Unhealthy Machines; Configuring Conservatively); Combining Strategies to Manage Load; Case Study 2: When Load Shedding Attacks

  3. Queue signals of saturation
    Google Site Reliability Engineering - selected core chapters

    The Four Golden Signals (Saturation: 99th percentile over one minute as early signal); Choosing an Appropriate Resolution for Measurements

Focus on

  • Open-loop sends on a schedule whether or not replies returned; closed-loop waits for each reply. Past the knee, closed-loop self-throttles and reports flat latency while the queue explodes.
  • Seeded simulation (CPython 3.14.4, seed 21, 10 ms service, 500 ms stall every 200th request, 30 s): capacity is about 80.3 rps. Open loop at 60, 80 and 90 rps gives mean 96.3, 341.1 and 1843.1 ms and p99 502.8, 759.1 and 3727.5 ms, and the 90 rps numbers keep growing with run length. Closed loop with 5 clients gives mean 62.1 ms at 80.5 completed rps. Same server, different stories.
  • The first saturation point is where queue wait passes service time and goodput stops rising with offered load. Past it the bottleneck migrates: server CPU, then queue memory, then the dependency.
  • Keep every raw sample. Percentiles come from the retained records with \(n\); the generator log is part of the evidence.

Reproduce closed-book

Write a small open-loop generator with CPython 3.14.4 (random.seed(21), Poisson schedule via random.expovariate, latency counted from the intended send time, one FIFO server with 10 ms service and a 500 ms stall on every 200th request, 30 s) and confirm the 80 rps row: mean 341.1 ms, p50 341.1 ms, p95 649.5 ms, p99 759.1 ms with nearest-rank percentiles. Then run the closed-loop twin (5 clients, next request on completion: mean 62.1 ms, p99 540.0 ms, 80.5 completed rps) and state which run to trust for tail latency and why.

Traps

  • Tuning the closed loop until latency looks good. Fewer clients or think time hides the queue; the offered load is no longer the stated load.
  • Reading server-side latency only. Queue wait before the handler is user-visible latency; instrument arrival-to-start separately.
  • Calling the knee at 100% CPU. The first bottleneck is whatever queue grows first: threads, connections, memory or the dependency.

Practice

The section mini-project covers this: an open-loop sweep of the learner's service through the predicted knee with retained raw records, measured p50, p95 and p99 with \(n\), queue depth, utilization, errors and recovery, reconciled against the Little's Law prediction.

Self-test

  1. Open-loop p99 is 759 ms and closed-loop p99 is 540 ms on the same server. Which is honest?

  2. Throughput rises with offered load, then flattens while p95 climbs. What happened?

  3. Why record intended send time, not just start and end?

Completion criterion

Stop when

Both generators run from your file, their latency pictures disagree as stated, and you can point at the knee with the bottleneck named.

Mark passed, then open 6.6 Only mark this when you can do it without notes.

Leads to

Comes after

Resources for this unit

  • Google Site Reliability Engineering - selected core chapters
    Google SREprimarycourse
    Read Chapters 3, 4, 6, 10, 12, 17, 19-22: risk, SLOs, monitoring, alerting, troubleshooting, reliability tests, load balancing, overload and cascading failure. Apply every concept to the same bounded RPC and store rather than inventing separate examples.
  • Google SRE Workbook - SLO, load, incident and canary exercises
    Google SRErequiredpractice
    Use Chapters 2, 4, 9-11, 12, 14, 16 and 17. Define one SLO, estimate capacity, load through saturation, canary a changed version, roll it back, and write one evidence-based incident timeline.
  • Gil Tene - How NOT to Measure Latency (talk)
    Strange Loop Conference via YouTubesupportreference
    Use for coordinated-omission vocabulary only: closed-loop testers that wait for each reply, the missing samples under queueing, and the correction concept of recording intended send time. Do not adopt wrk, hey or ab; write the small Python generator in the saturation unit instead.

Also in this section

  • OpenTelemetry Python - metrics, logs and traces
    OpenTelemetryrequiredreference
    Instrument request ID, queue wait, handler time, storage time, status and bounded labels. Export locally, retain raw load records and verify that instrumentation does not hide the bottleneck or create unbounded cardinality.
  • AlgoMaster System Design - quantitative and failure drills
    AlgoMastersupportpractice
    Use Solve Little's Law, Calculate System Availability, Plan Reliability Recovery Targets, Calculate Amdahl's Law Speedup, Analyze Capacity Bottlenecks, Simulate Partition Quorums and Audit Failure Domains only after producing your own estimates. Compare the platform answer with measured service behavior.
  • Python Experimental Systems Kit - measurement slice
    Roadmap-Finalsupportproject
    Use its artifact, bounded-pipeline, failure-injection, profiling and reproducibility requirements as the evidence checklist. Reuse the current service instead of building the full project again.
  • M/M/1 queue - model definition and stationary analysis
    Wikipediareferencereference
    Read Model definition (Poisson arrivals, exponential service, single server, infinite buffer, FIFO) and Stationary analysis (stability \(\lambda < \mu\), \(\rho = \lambda/\mu\), \(L = \rho/(1 - \rho)\), response time \(1/(\mu - \lambda)\) via Little's Law). Use the closed forms as approximations with assumptions stated, checked by your own simulation.

Quick find

Search Michi

Type to search every route, section, unit, topic and resource.

Enter opens the first result Esc closes

Reference

Keyboard shortcuts

n
Continue to the first unit not passed
j / k
Next / previous unit
1 2 3
Toggle learned, practised, passed
/
Open search
?
Show this help
Esc
Close open panels