...

/

Examples of Resource Estimation

Examples of Resource Estimation

Try your hand at some of the back-of-the-envelope numbers.

Introduction

Now that we’ve laid the foundation for resource estimation, let’s make use of the knowledge we gained in the previous lesson to estimate resources like servers, storage, and bandwidth. Below, we consider the Twitter service, make assumptions, and based on those assumptions, we make estimations. Let’s jump right in!

Number of servers required

Let’s make the following assumptions about a Twitter-like service.

Assumptions:

  • There are 500 million (M) daily active users (DAU).

  • A single user makes 20 requests per day on average.

  • We know that a single server (with 64 cores) can handle 64000 RPS.

Estimating the Number of Servers

Daily active users (DAU)500Million
Requests on average / user / day20
Total requests / dayf10Billion
Total requests / secondf115K
Total servers requiredf2

Points to ponder

1.

Can you identify a hidden assumption in our calculations above?

Show Answer
Q1 / Q1
Did you find this helpful?

Plausibility test: For all BOTECs, we need to judge if our numbers seem reasonable. For example, if the estimate we obtained was two servers for a large service with millons of DAUs, that number can be a lower bound but seems far from reality.

Peak capacity

Often, large services need to be ready for any flash crowds. We can get an estimate for the peak capacity. We assume that there’s a specific second in the day when all the requests of all the users arrive at the service simultaneously. We use it to get the capacity estimation for a peak load. To do better, we’ll need request and response distributionsA request-response distribution refers to the statistical pattern or model that describes the timing and frequency of requests made to a system or service and the responses provided by that system or service. For example, we can measure the number and types of incoming requests in 24 hours., which might be available at the prototyping levelThe prototyping level refers to the early stage of product development, where a basic version is created for testing and design validation before full development. It helps identify and address issues early in the process.. We might assume that requests follow a particular type of distribution, for example, the Poisson distributionPoisson2.

By using DAU as a proxy for peak load for a specific second, we’ve avoided difficulties finding the distributions of requests. Therefore, the DAU will then become the number of requests per second. So the number of servers at peak load can be calculated as follows:

Press + to interact
Number of servers required for a Twitter-like service
Number of servers required for a Twitter-like service

If our assumption is correct that all of the workloads can show up simultaneously in a specific second and each of our servers can handle 64,000 requests per second, we’ll need the astronomical count of 157K servers! If that’s not feasible, then we have two potential paths forward now, as explained below.

Improving the RPS of a server

First, if we think our assumption for the peak load is correct, we can work out how many servers at max we can commission. Let’s assume we can employ 100,000 servers at most. ...

Access this course and 1400+ top-rated courses and projects.