Medium · Telecom and messaging
Voice and video call setup
People tap a name and expect the other phone to ring in a second or two. Your job is the setup: find where the person is, ring their devices and connect the two sides. Everyone calls at the same moments, like evenings and holidays. Practise this medium system design problem for free with a Google or GitHub account.
The brief
People tap a name and expect the other phone to ring in a second or two. Your job is the setup: find where the person is, ring their devices and connect the two sides. Everyone calls at the same moments, like evenings and holidays.
Think of the ringing part of a calling app or phone carrier.
Users, scale and requirements
- Who uses it
- 40 million people a month (approx.)
- Audience in plain numbers
- 40,000,000 people per month
- Normal peak
- ≈ 15,000 requests per second
- Request mix
- Message: 70%; Analytics event: 10%; Read: 10%; Sign-in: 10%
- Speed for 99 of 100 requests
- Message: ≈ 300 ms; Read: ≈ 400 ms; Sign-in: ≈ 1,000 ms
- Successful requests
- 99.95%
- Data safety
- At most 1 minute of writes may be lost.
- Monthly budget
- ≈ $29,000
- Data at rest
- ≈ 3 TB
- Where users are
- North America: 40%; Europe: 35%; Asia Pacific: 25%
- Home region
- North America
- Waiting deadlines
- Message: 900 seconds; Analytics event: 3,600 seconds; Read: 900 seconds; Sign-in: 900 seconds
≈ marks an approximation, just as in the game. Waiting deadlines measure the age of queued work and are separate from interactive response time.
- Setting up one call takes about 8 small messages (approx.).
- About 1,900 calls begin each second at the evening peak (approx.).
- All numbers are rough approximations.
Questions that shape the design
Do you carry the voice itself?
No. Voice and video flow between the phones or a media service. You only set the call up and tear it down.
How fast must a call ring?
About 2 seconds from the tap. Longer feels broken.
What if a data centre fails?
Calls already in progress should continue. New calls must find another route quickly.
The traffic day
Lunch and evening meal peaks. The clock covers 00:00 to 24:00 in the home region. Events add pressure on top of that normal traffic.
19:00 · Flash crowd
A scheduled launch brings a sudden rush of requests.
Traffic reaches 2.5 times the scheduled load; rises over 30 seconds, holds for 900 seconds and eases over 1,800 seconds.
21:00 · Zone outage
An availability zone loses power or network access.
Duration: ≈ 3,600 seconds.
What a strong design has to handle
- To ring someone you must know which server holds their open connection. Where can that be kept?
- Recover call setup across multiple devices without duplicate accepted calls.
- Keeping presence in a fast store makes ringing quick, but it may briefly say a person is online after they left.
- Running in several regions keeps calls quick for everyone, at the price of more machines and a harder failover plan.
Make a prediction, run a full traffic day, then compare the result. The in-game editorial opens after a finished day and includes measured reference designs.
Concepts to practise
Related problems
- Medium
Telehealth video visits
Patients join a video visit with a doctor from their phone. Most calls go straight between the two people, but the platform runs the waiting room, chat, sign-in, the join link and a relay for the calls that cannot connect directly. A bad minute here means a patient staring at a spinner.
- Medium
Online exam
A national board runs a two-hour online exam for 200,000 students in three regions at the same time. Answers save automatically every half minute, a live heartbeat shows the student is still there, and proctoring marks suspicious events. Every saved answer matters. A minute of outage at the wrong time is a national story.
- Medium
Smart home
One million homes have a hub that keeps a live connection to your cloud. The hub reports its devices every few minutes, and the phone app sends commands like "lock the door". Commands must feel instant and must not be repeated. Once in a while a power cut ends and every hub reconnects together.
- Hard
Live streaming
Streamers broadcast live and thousands watch together, with a chat on the side. Everyone wants the same piece of video at the same second, so nothing can be saved for later. When a big streamer goes live, the whole audience arrives at once.