Card 07/ 08
Practice: Estimating a Chat App's Traffic and Storage
Twenty million users, forty messages each a day: how many servers, and how much disk?
Estimating requests a second, peak capacity and storage all come together on one brief here. Work each number on paper before opening the answer, and write your assumptions beside it.
The brief. A chat app has 20 million daily active users. Each sends 40 messages a day. Each message, with its sender, time and conversation id, takes about 1 KB to store. Messages are kept for one year. One message server handles 5,000 messages a second, and the evening peak is three times the average.
- How many messages a second, on average?
- How many message servers at the peak, with a spare?
- How much storage does a year of messages need?
Check your estimates
1. 20,000,000 × 40 = 800,000,000 messages a day
800,000,000 ÷ 86,400 = about 9,300 a second on average
2. Peak: 9,300 × 3 = about 27,800 a second
27,800 ÷ 5,000 = 5.6, so 6 servers
Plus one spare = 7 servers
3. 800,000,000 × 1 KB = 800 GB a day
800 GB × 365 = 292,000 GB, about 292 TB a yearIf you sized for the average, you would have chosen two servers and failed every evening. If you got 292,000 TB, a unit step was skipped: 800,000,000 KB is 800 GB. A real design would also count read traffic, since each message is read by everyone in the conversation, which is a good next assumption to add.
- System Design
- Performance
← → move through sections and cards