Menu

Earn Premium with Referrals

Invite your friends and earn Premium rewards through our referral program.

See how it works and start inviting friends.

Peak-to-Average Ratio
HLD

Peak-to-Average Ratio

How spiky is your traffic — diurnal curves, event multipliers, and the ratio that decides provisioned capacity.

The Ratio That Sizes Everything

 PEAK-TO-AVERAGE (P:A) = busiest sustained period ÷ ordinary average

 every provisioned quantity traces to it:
   node counts, DB connections, cache memory, autoscaling ceilings,
   and the cloud bill's floor

 average is a COST number; peak is an ARCHITECTURE number

Typical Ratios by Traffic Shape

PatternP:AExample
Global consumer app1.5–2xTime zones flatten the curve
Single-region consumer app2–3xLocal evening prime time
B2B/work-hours product3–5xDead nights, dense 9–5
News/social breaking events5–20xCelebrity news, match finals
Ticket drops / flash sales50–500x+Scheduled stampedes

The pattern worth internalizing: geographic spread buys free smoothing. A global user base is its own load-leveler; regional products wear their dinner hour openly.

The Two Peak Species

 DIURNAL (predictable)               EVENTAL (scheduled/chaotic)
 rises over hours                    arrives in seconds
 autoscaling can follow ✓            autoscaling too slow ✗
 forecast from history               forecast from calendar/contracts
 
 capacity answer:                    capacity answer:
 floor + elastic ceiling             pre-provision + admission control
                                     + graceful degradation plan
 
 mixing them up is the classic outage: elastic infrastructure
 meeting a ticket-drop spike meets reality in seconds

Working the Number

RideShare rider traffic:

 average        ≈ 1,400 rps
 weekday P:A    = 2.5 → peak ≈ 3,500 rps → provision ~4k with headroom
 New Year's Eve (evental): observed 4x normal peak historically
                → surge playbook: shed non-critical features,
                  pre-warm caches, freeze deploys that night
 
 three ratios, three operating postures — all from one number

The Cost Consequence

Provision-for-peak means paying for idle off-peak — unless narrowed deliberately:

 narrowing levers:
 - autoscaling between floor and ceiling   (elastic middle)
 - regional staggering of batch work       (fill valleys)
 - demand shaping: off-peak pricing, queue-with-estimates
 - degradation tiers for beyond-ceiling moments
 
 cost of serving = f(P:A). flattening the curve IS an architecture feature.

Interview Framing

Strong candidates volunteer the ratio with its species (“diurnal 2.5x handled elastically; launch-day spikes get admission control because scaling reacts in minutes, spikes arrive in seconds”). When interviewers inject “what if 100x?”, the correct move is recognizing the species change — not multiplying servers on paper. The ratio isn’t just arithmetic; it selects the resilience strategy.

My Private Notes

Notes are auto-saved locally to this device.