Thinking in Scale
Scale is the amount of work a system must handle as demand grows. Thinking in scale turns a large daily total into the load arriving each second.
One million requests in a day
A daily total looks large until its requests are spread over every second in the day.
daily_requests = 1000000
seconds_in_day = 86400
per_second = round(daily_requests / seconds_in_day)
print("Daily requests:", daily_requests)
print("Requests per second:", per_second)One hundred million requests in a day
The same division shows how fast the per-second load grows as the daily total grows.
daily_requests = 100000000
seconds_in_day = 86400
per_second = round(daily_requests / seconds_in_day)
print("Daily requests:", daily_requests)
print("Requests per second:", per_second)Example
daily_counts = [1000000, 100000000]
for daily in daily_counts:
per_second = round(daily / 86400)
print(daily, "per day ->", per_second, "per second")Key points
- Requests per second: a count of how many requests arrive in one second.
- Conversion: divide a daily total by 86,400 to get requests per second.
- Small worked example: 1,000,000 requests a day averages about 12 requests per second.
- Large worked example: 100,000,000 requests a day averages about 1,157 requests per second.
In this example, one division is applied to each daily total, so the two printed rates can be compared directly.
Note
requests per second is usually rounded to a whole number, because part of a request has no meaning.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
A system receives 1,000,000 requests in one day. About how many requests per second is that on average?