Final challenge: estimate a messaging app
After this: Estimate requests, servers and storage for a new service, step by step.
This challenge estimates a new service from start to finish. Chatter is a messaging app. Here are its assumptions, written down as lesson 1 asks:
| Assumption | Value |
|---|---|
| Daily active users | 20 million |
| Messages each user sends per day | 30 |
| Size of one message, with its record | 500 bytes |
| Copies kept of every message | 3 |
| Busiest time of day (the peak) | 2 × the average, until step 5 changes it |
| Requests one server handles per second | 400 |
You will work out the average messages per second, the servers needed at the peak, and the space a year of messages takes. Then you will complete the calculator's server line, and see what one changed assumption does to the answer. Each step is scored on its own. Step 4 shows its code in Python and in Java, and the answer is the same in both. You can try as many times as you like, and hints work as they do in the lessons.
Step 1 of 5Average sends
Average sends
Chatter has 20 million daily active users, and each sends 30 messages a day. About how many messages per second are sent on average?
Servers at the peak
Assume Chatter's peak is 2 × its average of 6,944.4 messages per second, and one server handles 400 per second. How many servers does it need?
Space per year
Each of Chatter's 600 million messages a day takes 500 bytes, with its record. Chatter keeps 3 copies. How much space do a year's new messages take?
Complete the calculator
Complete the line that counts the servers needed at the peak, rounding up, so that the program prints 6944 13889 35. Name it servers; math is already imported.Make it a long named servers.
import math
users = 20_000_000sends_per_user = 30per_server = 400
per_second = users * sends_per_user / 86_400peak = per_second * 2_______________________________ # ← servers needed at peakprint(round(per_second), round(peak), servers)public class Main { public static void main(String[] args) { long users = 20_000_000; long sendsPerUser = 30; long perServer = 400;
double perSecond = users * sendsPerUser / 86_400.0; double peak = perSecond * 2; _______________________________ // ← servers needed at peak System.out.println(Math.round(perSecond) + " " + Math.round(peak) + " " + servers); }}Change one assumption
Someone measures a similar app and finds its peak is 5 × its average, not 2 ×. With Chatter's average of 6,944.4 per second and 400 per server, how many servers now?
- Estimate a messaging app from its assumptions: about 6,944 messages per second, 35 servers at the peak, and 328.5 TB a year with 3 copies, then see a 5 × peak raise the servers to 87.