Capacity economics
Prerequisite: node-incident-response-and-recovery. Objective: Compare cost and latency assumptions. Each example is independent. Use Node.js 22.16.0 in a disposable directory; save as main.mjs and run node main.mjs. No external service is contacted.
How it works
Start with arrival rate, observed service time and dependency limits. In a stable system, average in-flight work is approximately arrival rate times average time in system (Little’s law); this says nothing about worst-case latency. Reserve headroom and bound queue length. Multiplying replicas also multiplies per-process connection pools. Estimate compute, transfer, storage, database and telemetry separately; actual pricing depends on region, units and plan. The examples use fictional rates and capacities.
Compare fictional monthly cost in cents
const hours=720, replicas=3, centsPerHour=8, transferGB=120, centsPerGB=5;console.log(hours*replicas*centsPerHour+transferGB*centsPerGB);Expected output:
1788017880 cents is 178.80 fictional currency units, before database and other charges.
Check connection budget before scaling
function fits(replicas,pool,limit,reserve){return replicas*pool<=limit-reserve;}console.log(fits(4,12,60,10),fits(5,12,60,10));Expected output:
true falseFour pools use 48 of 50 available slots; five would exceed the reserved budget.
Common mistake
Do not infer tail latency from mean concurrency or scale replicas without accounting for database and downstream limits.
Practice
Estimate cost for two versus four replicas and explain which measured throughput and latency evidence would justify the additional cost.
Reference candidate: node-capacity-economics-lookup (route unverified). Documentation anchor: https://sre.google/workbook/implementing-slos/ (related documentation, not exact-version validation).
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
Capacity economics — knowledge check
Apply the lesson to a fresh scenario and explain the evidence boundary.
At 50 requests/s and 0.2 s mean time, what is mean concurrency under stable assumptions?
What limits scaling five replicas with pool size 12 and 50 available connections?
What is a fictional cost model?