educative.io

Educative

Number of servers calculation?

Hi,
I am confused about No. of servers calculation—-
No. of active Users/Queries handled per server
Plugging in numbers from the assumptions outlined:
No. of active users = 510**6
Read Reqs per User=20 per day
Uploads=250K
Queries handled per server=500
86400

Could you please break the calculation down, I am not able to figure out how the 10K number is arrived at.
I could be missing Smthg
Thanks and Regards


Course: Grokking Modern System Design Interview for Engineers & Managers - Learn Interactively
Lesson: Requirements of a Blob Store's Design - Grokking Modern System Design Interview for Engineers & Managers

Hi Roop_G, thanks for reaching out.

We assumed the following numbers:
Number of active users = five million = 5,000,000
Queries handled per server (The number of requests per second that a single blob store server can handle) = 500

Putting the above values in the No. of servers calculation formula gives us the following:
No. of servers = Number of active users/Queries handled per server = 5,000,000/500 = 10,000 =10K

I hope it helps. Let us know if you have any other questions or concerns. Thanks!

2 Likes

Hi Asmat,
thanks for clarification.
I see the capacity has been planned around No. of DAU and not their query/upload volume as in the worst case scenario all the users could be concurrent.

Pardon me for the typos in the question:
I meant the following
No. Of active users= 5 x 10 pow 6
Read Requests per user = 20 per day
Total Uploads in a day = 250000
Uploads per second = 250000/86400 = approx 2.5
Query load on the system per second: ((5 x 10 pow 6) x 20)/86400 = approx 1000QPS read and 2.5 QPS writes = approx 1200 QPS overall(given write could be more expensive)

So my confusion was around that if a Blob server can handle 500 QPS then the capacity planned needs to be = 1200/500 x 3(Replication factor). = 8 x 3 = 24

Regards

1 Like

Yes, you have a good point. Thank you for bringing it up.

The calculation that you have done is logical and good enough to be presented in an interview, and it seems to work best if we have a uniform distribution of requests during the day. Dividing per-day read requests and uploads equally in each second of the day gives us a uniform distribution of requests, which is the ideal case.

However, the formula we presented assumes that all daily active users are concurrently requesting and that each user generates one request per second. It covers the request load during peak hours. But of course, besides peak hours, our servers will mostly be idle. And for this, we can use the elasticity concept for resources, as we acquire resources when needed and give back resources to the provider when there is no need.

Your method and our method can be considered two ends of the estimation spectrum—yours is like the best case, and ours is like the worst case. Ideally, in an interview, a candidate can present both.

Our number of servers calculation does not assume the request size. We assume that, on average, our single blob store server handles 500 requests per second. There is a separate calculation for bandwidth and storage.

We are open to any other questions or concerns. Thanks for such constructive feedback.

1 Like