Easy · Healthcare
Clinic appointment booking
A group of 60 clinics lets patients find a free slot, book it and get a text reminder. Slots open at 8 am, and the phone lines used to melt. Two people must never get the same slot, and reminders must go out even when the text-message company has a bad hour. Practise this easy system design problem for free with a Google or GitHub account.
The brief
A group of 60 clinics lets patients find a free slot, book it and get a text reminder. Slots open at 8 am, and the phone lines used to melt. Two people must never get the same slot, and reminders must go out even when the text-message company has a bad hour.
Think of booking a doctor's visit online.
Users, scale and requirements
- Who uses it
- 300 thousand patients a month (approx.)
- Audience in plain numbers
- 300,000 people per month
- Normal peak
- ≈ 300 requests per second
- Request mix
- Read: 52.9%; Search: 25%; Write: 10%; Sign-in: 12%; Notification: 0.1%
- Speed for 99 of 100 requests
- Read: ≈ 700 ms; Search: ≈ 400 ms; Write: ≈ 700 ms; Sign-in: ≈ 1,000 ms
- Successful requests
- 99.9%
- Data safety
- No acknowledged write may be lost.
- Monthly budget
- ≈ $7,600
- Data at rest
- ≈ 0.5 TB
- Where users are
- North America: 100%
- Home region
- North America
- Waiting deadlines
- Read: 900 seconds; Search: 900 seconds; Write: 3,600 seconds; Sign-in: 900 seconds; Notification: 900 seconds
- Fresh reads
- People must see their own changes. At most 0.1% of reads may be stale in the model.
- Personal reads
- 50% of reads are private; a shared public copy cannot answer them.
- Required proofs
- Signed-in access; Tested backups
≈ marks an approximation, just as in the game. Waiting deadlines measure the age of queued work and are separate from interactive response time.
- Peak means the busiest minute of a normal weekday, approx.
- A reminder text costs about a cent; the cost line is small but real.
- Notification speed measures provider acceptance. Device receipt is outside this traffic model; check expiry, provider outcome and retries in the correctness trace before claiming delivery guarantees.
Questions that shape the design
Can two patients hold the same slot?
Never. A double booking means a patient turns up and there is no room for them, so a booked slot must be recorded exactly once.
Do reminders have to arrive instantly?
No. A reminder a few minutes late is fine, but it must not be lost. That means it can wait in a line.
How busy is the 8 am rush?
About six times a normal busy hour, for around ten minutes, when new slots open.
Do patients sign in?
Yes. Records are private, so every booking is tied to a signed-in patient.
The traffic day
Traffic concentrated in working hours. The clock covers 00:00 to 24:00 in the home region. Events add pressure on top of that normal traffic.
08:00 · Flash crowd
A scheduled launch brings a sudden rush of requests.
Traffic reaches 6 times the scheduled load; rises over 60 seconds, holds for 600 seconds and eases over 900 seconds.
10:30 · Provider rate limit
An outside service lowers its configured request quota and answers 'too many requests' above the reduced limit.
Provider capacity falls to 10% of its configured quota. Duration: ≈ 2,400 seconds.
What a strong design has to handle
- Reminders are not urgent. What lets the work wait without losing it?
- Synchronous replication makes every booking a few milliseconds slower, but a zone failure can never lose or double a booking.
- A 60-second cache keeps the database calm but may show a slot that was just taken; the booking step checks again, so nobody is double booked.
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
- Hard
Stock order matching
Brokers and traders send buy and sell orders, and you pair them fairly: the earliest order at the best price goes first. At the market open a rush of orders arrives in seconds. Every accepted order must be in one agreed sequence, and no trade may be lost or invented.
- Easy
Lab results portal
Labs send results to a portal, patients get a notice that a result is ready and open it. When the notice goes to thousands of people at the same minute, they all open the portal at once. Nobody should get the same notice twice.
- Hard
Vaccine sign-up surge
A county opens 80,000 vaccine appointments at 8 am. Within seconds, thousands of people reload and bots try to grab slots. The site must stay up, never sell the same slot twice, and be fair to people on a phone with a poor signal.
- Medium
Notification service
Every other team asks you to send messages: order shipped, new login, a sale starting. You send them by push, email and text through outside providers who have their own limits. Send each message once, and never block the team that asked.