Sub topic 4
Time conversions: seconds per day and per year
This chapter assumes you can work with powers of ten and have read the chapters on stating assumptions and on powers of two. Almost every traffic and storage estimate converts a number "per day" or "per year" into a rate "per second". That step needs a few time constants you can recall instantly.
The numbers to memorize
A day has 24 × 60 × 60 = 86,400 seconds. For quick math, round it to about 100,000 (10^5) seconds. The error is about 16%, which is small next to the uncertainty in most inputs.
| Period | Exact seconds | Rounded for estimates |
|---|---|---|
| 1 minute | 60 | 60 |
| 1 hour | 3,600 | about 4 thousand |
| 1 day | 86,400 | about 100 thousand (10^5) |
| 1 month (30 days) | 2,592,000 | about 2.5 million |
| 1 year (365 days) | 31,536,000 | about 30 million (3 × 10^7) |
You can derive the year from the day. 86,400 × 365 is about 31.5 million. Rounding to 3 × 10^7 is close enough for a design discussion.
The shortcut: requests per day to QPS
QPS means queries per second. To get it from a daily count, divide by 86,400. Since 1 million ÷ 86,400 is about 11.6, remember this rule:
- 1 million requests per day is about 12 QPS.
- 100 million per day is about 1,200 QPS.
- 1 billion per day is about 12,000 QPS.
With the rounded 10^5, you get 10 QPS per million per day. That is a fast mental check, and it underestimates by about 14%.
Doing it in code
The same conversion as a runnable script:
seconds_per_day = 24 * 60 * 60
seconds_per_year = 365 * seconds_per_day
dau = 10_000_000
requests_per_user_per_day = 10
avg_qps = dau * requests_per_user_per_day / seconds_per_day
print(seconds_per_day) # 86400
print(seconds_per_year) # 31536000
print(round(avg_qps)) # 1157
print(round(avg_qps * 2)) # 2315 (assumed peak factor of 2)The last line applies an assumed peak factor of 2. That topic gets its own chapter. Here, note that the time conversion produces the average rate.
Going the other direction
You also convert a rate into a total over time. If a service writes 1,000 records per second, it writes about 1,000 × 86,400, or roughly 86 million, records per day. Over a year that is about 1,000 × 31.5 million, or roughly 31.5 billion records.
Availability targets use the same constants. A year has 365 × 24 × 60 = 525,600 minutes. At 99.9% availability, the allowed downtime is 0.1% of that, about 526 minutes.
Common errors
- Dividing by the wrong period. Counts per month need 2.6 million seconds, not 86,400. Check which unit your input uses.
- Forgetting to divide at all. A total of 1 billion requests per day is not 1 billion QPS.
- Mixing rounded and exact values in one chain. Pick one style, round first, and keep it throughout so the result stays easy to check.
- Treating the average as the load you must serve. Traffic is not flat across 86,400 seconds. Dividing by the full day gives the average only.
Exercise
A service handles 500 million requests per day. Using the rounded value of 10^5 seconds per day, what is the approximate average QPS? Then, using the exact 86,400, how far off was the rounded answer?
Show answer
Rounded: 500,000,000 / 100,000 = 5,000 QPS. Exact: 500,000,000 / 86,400 is about 5,787 QPS. The rounded answer is about 14% low, which is acceptable for an order-of-magnitude estimate.
Exercise
A system must achieve 99.99% availability over a year. About how many minutes of downtime does that allow, using 525,600 minutes per year?
Show answer
The allowed downtime is 0.01% of 525,600 minutes, which is about 52.6 minutes per year.