Sub topic 4
Time Conversions: Seconds per Day and per Year
This chapter assumes you can do arithmetic with large numbers and exponents, and that you know what a request, a queue and a server are. You do not need to have read the earlier chapters on powers of two, but you should be comfortable with the idea of rounding to keep math simple.
Almost every estimate in system design starts by dividing a count per day by a number of seconds. Servers, networks and disks are rated per second, but product requirements are stated per day, per month or per year. Time conversions are the bridge between the two. Getting them wrong by a factor of 10 or 100 changes the design.
The numbers to memorize
You need a small set of constants. The exact values are worth knowing once, and the rounded values are what you use in conversation.
| Unit | Exact seconds | Rounded for estimates |
|---|---|---|
| 1 minute | 60 | 60 |
| 1 hour | 3,600 | about 4,000 |
| 1 day | 86,400 | about 100,000 (10^5) |
| 1 week | 604,800 | about 600,000 |
| 1 month (30 days) | 2,592,000 | about 2.5 million |
| 1 year (365 days) | 31,536,000 | about 30 million (3 × 10^7) |
The 86,400-second day comes from 24 × 60 × 60. Everything else is a multiple of it.
A year is 365 × 86,400 = 31,536,000 seconds. Many people remember it as "about pi times 10 to the 7th," because π × 10^7 is 31.4 million. Either form works. Rounding to 3 × 10^7 is within 5% of the true value, which is much smaller than the uncertainty in any traffic assumption.
Why rounding 86,400 to 100,000 is usually fine
Dividing by 86,400 in your head is awkward. Dividing by 100,000 is trivial: you shift the decimal point five places.
The rounding error is 100,000 / 86,400 ≈ 1.16, so the shortcut underestimates the rate by about 14%. Compare that to your other inputs. If you assumed 10 million daily active users and the true number is 7 million or 15 million, the error is 30% to 50%. A 14% error from rounding is smaller than the error you already accepted.
There are two ways to use the shortcut:
- Round the day to 10^5 seconds when you want a fast answer and can tolerate underestimating by about 14%.
- Round the day to 86,400 when the result will be used for capacity numbers where you cannot afford to be low. Using 90,000 is a good compromise, because it is easy to divide by 9.
State which one you used. The point of a stated assumption is that a listener can check it.
Converting a daily count to a per-second rate
The core formula is:
average rate per second = events per day / 86,400
The events per day come from multiplying users by activity per user. The code below repeats the traffic example from the plan and adds a helper so the constants are named instead of buried in expressions.
SECONDS_PER_MINUTE = 60
SECONDS_PER_HOUR = 60 * SECONDS_PER_MINUTE
SECONDS_PER_DAY = 24 * SECONDS_PER_HOUR
SECONDS_PER_YEAR = 365 * SECONDS_PER_DAY
def per_second(events_per_day):
return events_per_day / SECONDS_PER_DAY
dau = 10_000_000
requests_per_user_per_day = 10
peak_factor = 2
daily_requests = dau * requests_per_user_per_day
avg_qps = per_second(daily_requests)
peak_qps = avg_qps * peak_factor
print(SECONDS_PER_DAY) # 86400
print(SECONDS_PER_YEAR) # 31536000
print(round(avg_qps)) # 1157
print(round(peak_qps)) # 2315Here 100 million requests per day becomes about 1,157 requests per second on average. With the shortcut, 10^8 / 10^5 = 1,000, which is 14% low but lands in the same order of magnitude.
A useful memory aid follows from this. One million events per day is about 12 per second, since 10^6 / 86,400 ≈ 11.6. From that single fact you can scale up:
| Events per day | Average per second |
|---|---|
| 1 million | about 12 |
| 10 million | about 120 |
| 100 million | about 1,200 |
| 1 billion | about 12,000 |
| 10 billion | about 120,000 |
If you keep only one row in your head, keep "1 million per day is roughly 12 per second."
Converting in the other direction
Sometimes you start from a per-second rate and need a daily or yearly total. This happens when you know a server's throughput and want to know what it handles in a day, or when you size storage from a write rate.
total = rate per second × seconds in the period
A service writing 1,000 records per second produces 1,000 × 86,400 = 86.4 million records per day. Over a year that is 1,000 × 31.5 million ≈ 31.5 billion records. Notice the useful rule: a rate of 1 per second is about 30 million per year, so multiply your per-second rate by 30 million to get a yearly count.
The storage example from the plan relies on the same arithmetic, with years converted to days first:
new_records_per_day = 100_000_000
bytes_per_record = 500
retention_days = 365 * 5
total_bytes = new_records_per_day * bytes_per_record * retention_days
print(total_bytes / 1e12) # 91.25 (terabytes, decimal units)Here the time conversion is 365 * 5 = 1,825 days. A common shortcut is to treat a year as 400 days and five years as 2,000 days, which gives 100 TB. That overstates by about 10%, but the answer is still in the correct range, and 100 TB is easier to reason about than 91.25 TB.
Time conversions for availability
Availability targets are stated as percentages, and the allowed downtime is a fraction of a year, month or day. This is where the seconds-per-year figure matters most.
minutes_per_year = 365 * 24 * 60
for availability in (99.9, 99.99):
downtime = (1 - availability / 100) * minutes_per_year
print(availability, round(downtime, 2))
# 99.9 525.6
# 99.99 52.56There are 525,600 minutes in a year. At 99.9% ("three nines"), the allowed downtime is 0.1% of that, or 525.6 minutes, about 8.8 hours. At 99.99% it is 52.56 minutes. Each extra nine cuts the allowed downtime by a factor of ten.
In seconds, the same targets look like this:
| Availability | Downtime per year | Downtime per 30-day month |
|---|---|---|
| 99% | about 3.65 days | about 7.2 hours |
| 99.9% | about 8.8 hours | about 43 minutes |
| 99.99% | about 52.6 minutes | about 4.3 minutes |
| 99.999% | about 5.3 minutes | about 26 seconds |
The monthly column is often more useful than the yearly one. A monthly budget of 4.3 minutes at four nines means a single slow deployment can use the whole budget.
A diagram of the conversion chain
The conversions form a chain. Each step multiplies or divides by a familiar factor, so you can start at any unit and reach any other.
Common errors
These mistakes show up repeatedly in estimates.
- Dividing by the wrong number of seconds. Using 24 × 60 = 1,440 (minutes) instead of 86,400 gives a rate 60 times too high. Write the units next to each number to catch this.
- Mixing months and days. A month is not 30 days in every case, and a year is not 12 × 30 = 360 days. The difference is about 1.4% and rarely matters, but be consistent within one estimate.
- Treating the average as the load you must handle. Dividing by 86,400 assumes traffic is spread evenly across the day. Real traffic is not. The peak factor, covered in a later chapter, corrects for this. The time conversion alone gives you only the average.
- Confusing decimal and binary units in the same line. Seconds are decimal, but sizes may be powers of two. Keep time conversions separate from size conversions, and convert each on its own line.
- Forgetting leap years and leap seconds. For estimates, ignore them. A leap year adds 0.27% to the seconds in a year, which is far below your other uncertainties.
- Computing availability from a monthly figure but reporting it as yearly. Check that the period in the downtime budget matches the period in the requirement.
Worked check: does the answer make sense?
Suppose a requirement says "a notification service sends 50 million messages per day." Walk through the check:
- Exact average: 50,000,000 / 86,400 ≈ 579 per second.
- Shortcut: 50,000,000 / 100,000 = 500 per second.
- From the memory aid: 50 × 12 = 600 per second.
All three agree within 20%. If a quick calculation instead gives 30 per second or 30,000 per second, you have a unit or exponent mistake, and you should recompute before moving on.
Summary of the working model
- A day has 86,400 seconds. For quick math, use 10^5 and accept 14% underestimation, or use 90,000.
- A year has about 31.5 million seconds. Use 3 × 10^7 for quick math.
- One million events per day is about 12 per second. Scale this linearly.
- One event per second is about 30 million events per year.
- Availability percentages convert to downtime by multiplying the unallowed fraction by minutes per year (525,600), or by the month, for a budget that matches your release cycle.
- The result of a daily-to-per-second conversion is an average. Apply a peak factor before sizing anything.
Exercise
A service receives 300 million requests per day. (a) Estimate the average requests per second using the 10^5 shortcut, and then using 86,400. (b) If peak traffic is 3 times the average, what peak rate should you plan for, using the exact figure? (c) The service must have 99.95% availability over a 30-day month. How many minutes of downtime are allowed?
Show answer
(a) With the shortcut, 300,000,000 / 100,000 = 3,000 requests per second. With 86,400, the result is about 3,472 per second, so the shortcut is about 14% low. (b) Peak is 3 × 3,472 ≈ 10,400 requests per second, so plan for about 10,000 to 10,500. (c) A 30-day month has 30 × 24 × 60 = 43,200 minutes. The allowed unavailability is 0.05% = 0.0005, and 0.0005 × 43,200 = 21.6 minutes.
Exercise
A sensor fleet writes 2,000 readings per second, and each reading is 100 bytes. Using 3 × 10^7 seconds per year, estimate how many readings and how much storage you accumulate in one year. Then say whether the answer would change by more than 10% if you used 31,536,000 seconds instead.
Show answer
Readings per year ≈ 2,000 × 3 × 10^7 = 6 × 10^10, or 60 billion. Storage ≈ 6 × 10^10 × 100 bytes = 6 × 10^12 bytes, about 6 TB. With 31,536,000 seconds the readings are 63.07 billion and the storage is about 6.3 TB. The difference is about 5%, so the rounding does not change the result by more than 10%.