Sub topic 7
Peak Load Versus Average Load
This chapter assumes you can convert daily active users (DAU) into average queries per second (QPS) and that you know a day has about 86,400 seconds. If not, review the traffic estimation chapter first.
Why the average is not enough
Average QPS spreads a day's requests evenly across 86,400 seconds. Real traffic is not even. Users are awake at similar hours, events trigger bursts, and a popular post can spike a service in minutes.
Servers fail at the busiest moment, not at the average one. A system sized for average load will be overloaded for part of every day. So you estimate both numbers and size for the peak.
The peak factor
The simplest method is to multiply average QPS by a peak factor:
peak QPS = average QPS × peak factorA factor of 2 is a common starting assumption for steady consumer apps. Use 3 to 5 for traffic tied to events, such as ticket sales, sports scores, or a morning commute. State the factor as an assumption, like any other number.
dau = 10_000_000
requests_per_user_per_day = 10
seconds_per_day = 86_400
peak_factor = 2
avg_qps = dau * requests_per_user_per_day / seconds_per_day
peak_qps = avg_qps * peak_factor
print(round(avg_qps)) # 1157
print(round(peak_qps)) # 2315With rounding, you would say "about 1,200 average, about 2,400 peak" and carry the rounded values forward.
Where the peak factor comes from
The factor should come from the shape of the traffic. Two common cases:
- Concentrated hours. Suppose most users are active during a 4-hour evening window and that window carries half of the day's requests. Those requests arrive in 14,400 seconds instead of 86,400, so the rate is 0.5 × 86,400 / 14,400 = 3 times the average.
- Global users. Time zones flatten the curve. A worldwide service often has a lower peak factor than a single-country one.
If you have real metrics, use the measured peak-to-average ratio instead of a guess.
Which number to use for what
Not every resource is sized for the peak. The table shows typical choices.
| Resource | Size for | Reason |
|---|---|---|
| Web and API servers | Peak QPS | Requests that exceed capacity are slow or fail |
| Network bandwidth | Peak | Links saturate at the busiest moment |
| Storage | Average | Data volume depends on totals, not on the rate |
| Cost estimates | Average, with peak headroom | You pay for provisioned capacity |
Storage grows with the number of records written, so average writes per day are enough there.
Common errors
- Reporting only the average. The design then fails at the first busy hour.
- Applying the factor twice. If your per-user activity already describes a peak hour, do not multiply again.
- Using one factor for reads and writes. Reads often spike more than writes, for example when content goes viral. State separate factors when it matters.
- Treating the factor as exact. It is an assumption. A reviewer should be able to change it and see how the result moves.
Summary
Compute average QPS first, then multiply by a stated peak factor. Use the peak for servers and bandwidth, and the average for storage totals.
Exercise
A service has 5 million DAU. Each user makes 20 requests per day. About 60% of the day's requests arrive in a 6-hour window. Estimate the average QPS and the peak QPS during that window. Round to the nearest hundred.
Show answer
Total requests per day = 5,000,000 × 20 = 100,000,000. Average QPS = 100,000,000 / 86,400 ≈ 1,157, about 1,200. The window has 6 × 3,600 = 21,600 seconds and carries 60,000,000 requests, so peak QPS = 60,000,000 / 21,600 ≈ 2,778, about 2,800. The implied peak factor is about 2.4.
Exercise
Why do you size storage from average writes but size web servers from peak QPS?
Show answer
Storage depends on the total number of records kept, which the daily average captures. Servers must handle the highest request rate at any moment, so the peak decides how many you need.