How I Calculate Capacity for Systems Design -2

RMAG news

Continuing from my previous article, Part 1 on calculating capacity for system design, you can find it How I Calculate Capacity for Systems Design-1

Adding more example to understand this in a better way

Example 1: Transaction Calculation

Let’s illustrate with an example where we have 1 million transactions in a day. To find out how many transactions occur per second (request per second or RPS):

Total transactions per second ( RPS ) = Total transactions per day / Number of seconds in a day

Number of seconds in a day = 24 hours * 60 minutes * 60 seconds = 86,400 seconds

Therefore, RPS = 1,000,000 / 86,400 ≈ 11.57 transactions per second

Now, if each user performs 50 API calls on average:

Total requests per second = RPS * Average API calls per user = 11.57 * 50 ≈ 578 requests per second

Example 2: YouTube Video Upload and Storage Estimation

Let’s assume the following for YouTube:

Total users: 2 billion
Daily Active Users (DAU): 4 million
Number of videos watched per day by each user: 5
Total views per day: 4 million * 5 = 20 million views/day
Views per second: 20 million / 100,000 (assuming 100K seconds in a day) ≈ 200 views/second

Assuming an upload-to-view ratio of 1:200 (each upload results in 200 views):

Uploads per second = Views per second / Upload-to-view ratio = 200 views/second / 200 views/upload = 1 upload/second

Assuming each upload is 10 MB in size:

Total storage required = Uploads per second * Size per upload = 1 upload/second * 10 MB = 10 MB/second

For storage estimation based on video size and user activity:

Maximum size of a video: 10 GB
Average uploads per user: 5 per day

Thus, storage needed per user per day = Maximum video size * Average uploads per user = 10 GB * 5 = 50 GB/day

Total storage for 4 million active users:

Total storage = Storage per user per day * Number of active users = 50 GB/day * 4 million = 200 petabytes/day

Basic Storage Calculation Formula:

Assuming write requests are x KB and there are y million users:

Storage needed = x KB * y million users = xy GB
Or, x MB * y million users = xy TB

This rewritten version clarifies each example with calculations and storage estimations based on the given parameters.

Please follow and like us:
Pin Share