Unit 4 of 9 · about 4 hours · derive

Little's Law, capacity and queueing approximations

Admission bounds and queue sizes from the Programming backpressure-graceful-shutdown unit, taken as assumed background, need numbers. This unit derives them: arrival rate times time in system is the queue you must bound.

You'll be able to

  • State Little's Law with units and its stability assumption, and solve for any one of arrival rate, concurrency and time in system.
  • Derive capacity, utilization and headroom for requests, bytes, storage, memory and bandwidth from a stated workload.
  • Apply an M/M/1 or M/D/1 approximation with its assumptions written down, and report the uncertainty range.

Covers

Arrival rate, service time, concurrency and Little's LawCapacity for requests, bytes, storage, memory and bandwidthBasic queueing-model approximations and uncertainty ranges
1

Read

In this order, only the parts listed

0 of 3 done

  1. M/M/1 stability and closed formsM/M/1 queue - model definition and stationary analysis

    Model definition (Poisson arrivals, exponential service, single server, infinite buffer, FIFO); Stationary analysis (stability , ); Average number of customers in the system (); Response time ( via Little's Law)

    Use the closed forms as approximations only. Your service is not proven Poisson or exponential; the simulation in Reproduce is the check.

  2. Capacity in resources, not queriesGoogle Site Reliability Engineering - selected core chapters

    The Pitfalls of 'Queries per Second' (cost per request varies; model capacity directly in CPU time and memory)

  3. Conservative capacity and scaling boundsGoogle SRE Workbook - SLO, load, incident and canary exercises

    Autoscaling (Configuring Conservatively: stay far from bottlenecks, spare capacity for overload and redundancy; Setting Constraints: minimum and maximum bounds); Avoiding Overloading Backends

2

Focus on

  • needs matching units: . It holds for long-run averages in a stable system; it predicts nothing about tails.
  • Utilization governs the wait. At 0.5, 0.8 and 0.95 the M/D/1 mean wait is 0.5x, 2x and 9.5x the service time; a seeded 60 s simulation at 10 ms service measured 4.86, 19.97 and 80.87 ms against theory 5, 20 and 95 ms.
  • Capacity is per resource. The bottleneck is the smallest capacity-over-work ratio: , and give 2500 rps at the database.
  • Approximations carry ranges. M/M/1 assumes Poisson arrivals and exponential service; burstier arrivals or heavier-tailed service widen the real wait. Report the assumption beside the number.
Common mistakes · 3
  • Applying to percentiles or to a draining queue. It relates long-run averages in a stable system only.
  • Quoting without a window. Poisson bursts exceed the average; size the bound for the peak window, not the daily mean.
  • Treating the M/M/1 number as measured. It is a prediction under strong assumptions; the simulation or load run is the check.
3

Try it yourself

Closed-book, before checking anything

Simulate a single FIFO server with CPython 3.14.4: random.seed(11), Poisson arrivals at 80/s from random.expovariate for 60 s, deterministic 10 ms service. The mean queue wait should be 20.475 ms against M/D/1 theory ms, so the mean time in system is 30.475 ms and Little's Law gives . Check the law directly: the time-average number in system over 5 to 55 s is 2.52, against 2.49 for the arrivals in that window. Then size servers: 0.8 average busy, so one server runs at 0.8 and two at 0.4.
4

Quiz yourself

Answer first, then mark it. Missed ones go to Review.

0 got · 0 missed

  1. 1.100 rps with 50 ms in system: average concurrency?Answer

    5 requests (). Units: .

  2. 2.Single server at 0.95: mean wait as a multiple of service time?Answer

    M/D/1 gives x; M/M/1 gives x. State which model you used.

  3. 3.Capacities , and per request: max throughput and bottleneck?Answer

    2500 rps at the database (), the smallest ratio.

  4. 4.The simulation gives 80.87 ms at 0.95 against theory 95 ms. Contradiction?Answer

    No. Near 1 the queue relaxes slowly and the run starts empty, so a 60 s run reads low. Lengthen it, drop a warm-up, repeat with several seeds and report the spread beside the theory.

5

Practice

  • AlgoMaster: Solve Little's Law

    LittlesLawCalculator.solve: detect the -1 argument and rearrange , rounded to 5 places (examples: ; rps)

    Attempt only after your own three-way derivations. Keep units attached: throughput in requests/s, latency in seconds.

  • AlgoMaster: Analyze Capacity Bottlenecks

    maxThroughput (minimum of capacity/work ratios) and bottleneck (name of the smallest ratio; alphabetical on ties)

    Attempt only after your own per-resource ratios. Select the bottleneck from unrounded ratios.

You're done when

You solve all three Little's Law directions without notes and can size one server count from a stated workload with the model assumptions listed.

Only when you can do this without notes.

Leads to

Notes

Resources · 3 for this unit, 4 more in the section
  • Google Site Reliability Engineering - selected core chaptersGoogle SRE · primary

    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 exercisesGoogle SRE · required

    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.

  • M/M/1 queue - model definition and stationary analysisWikipedia · reference

    Read Model definition (Poisson arrivals, exponential service, single server, infinite buffer, FIFO) and Stationary analysis (stability , , , response time via Little's Law). Use the closed forms as approximations with assumptions stated, checked by your own simulation.

Also in this section

  • OpenTelemetry Python - metrics, logs and tracesOpenTelemetry · required

    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 drillsAlgoMaster · support

    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 sliceRoadmap-Final · support

    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.

  • Gil Tene - How NOT to Measure Latency (talk)Strange Loop Conference via YouTube · support

    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.