An ML service has 100 million daily active users, and each user triggers 20 model requests per day. Peak traffic is the daily average, and one server handles 500 QPS (queries per second) within the latency target. What are the average QPS, peak QPS, minimum servers needed, and servers needed with 30% headroom? Why do you size for peak rather than average?
ML system design, Estimation
Level L2 Elementary. Length Short. Nature Mat Mathematical.
What's being asked
Whether you can convert daily user counts into serving capacity cleanly and know why systems must be sized for traffic peaks.
Key idea
Multiply DAU (daily active users) by requests per user and divide by seconds per day to get average QPS, then multiply by the peak factor and headroom before dividing by per-server capacity. Sizing for the daily average fails during busy hours when queues build up and latency spikes.
Steps
- Total daily requests: requests per day.
- Average QPS: divide by seconds in a day (), giving .
- Peak QPS: multiply by the peak factor of , giving .
- Servers needed: at per server, peak traffic requires , or servers at the bare minimum. Adding headroom () gives servers. (Some teams define headroom as a target utilisation instead, for example 70%, which would give , so servers; state which convention you use.)
- Why plan for peak, not average: user traffic clusters into evening or workday peaks, and queueing latency grows steeply as server utilisation approaches . Sizing for peak with headroom absorbs bursts, node failures and rolling deploys without breaching latency targets.
Common mistakes
- Replacing with without stating that it is a rough mental-maths approximation.
- Provisioning for average QPS ( servers), which overloads the cluster for hours every day during peak traffic.
- Running at utilisation at peak with zero headroom, leaving no margin when one machine crashes or restarts.
How long your answer should be
Four lines of arithmetic and two sentences on peak headroom; about 2 minutes.
Read this
Previous in ML system design: Why do we sometimes train one model on several GPUs at once, and what is the simplest way to share the work between them?
Next in ML system design: When should you choose batch (offline, precomputed) inference over online (real-time) inference, and how do hybrid designs combine the two?