Skip to content

← Interview Arena

Design a global messaging system

Design a global messaging system

The Arena needs JavaScript to run an interview.

Design a global messaging system: people send one-to-one and group messages, the service works for users on three continents, keeps each conversation in one order, and keeps some users' messages in their own region. Work through the stages in order, as you would on a whiteboard: requirements, numbers, architecture, scaling, consistency, reliability, failure and trade-offs.

Key facts

Users
100 million
Daily users
20 million
Messages
5 billion a day
Message size
About 200 bytes, metadata included
Where the users are
40 % in North America, 30 % in Europe, 30 % in Asia-Pacific, with one region on each continent
Messages that cross regions
15 % are for someone whose home region is another
Round trips
20 ms to the nearest region, 80 ms to the next continent, 160 ms to the far one
A call between regions
About 100 ms
Peak
Assume the busiest moment is 3 times the average
Residency
The messages of some users may not be kept outside their own region
One chat stack in a region
Carries about 106,667 messages per second
The stores of the three regions
Write about 450,000 copies a second in total

Constraints

  • Media, search, read receipts and end-to-end encryption are out of scope unless you choose to cover them.
  • In the Architecture Builder the workload is the peak, with 80 % writes (a message sent) and 20 % reads (opening a conversation): that split is an assumption for the exercise.
  • The figures are illustrative targets and model figures from the Global messaging case study for this exercise, not measurements of a real service. The course gives no legal advice.

Suggested time per stage

  1. Requirements05:00
  2. Estimation06:00
  3. Architecture10:00
  4. Scaling06:00
  5. Consistency04:00
  6. Reliability04:00
  7. Failure scenarios05:00
  8. Trade-offs05:00
Mode

You can pause the clock, nothing is locked, and running out of time is only shown.

The clock cannot be paused. At zero, the stage you are on is locked as written and the stages after it score zero.

Length

Built by GhaziAlibi.

© ShardCraft. All rights reserved.