Hard · Telecom and messaging
Bulk text campaigns
Businesses send a coupon or an alert to hundreds of thousands of phones at once. Carriers accept texts only at a fixed speed, every text costs real money, and a person who replied STOP must never be texted again. Delivery receipts come back by the thousand and must be counted. Practise this hard system design problem for free with a Google or GitHub account.
The brief
Businesses send a coupon or an alert to hundreds of thousands of phones at once. Carriers accept texts only at a fixed speed, every text costs real money, and a person who replied STOP must never be texted again. Delivery receipts come back by the thousand and must be counted.
Think of the platform behind store coupons and delivery alerts, like Twilio or Braze.
Users, scale and requirements
- Who uses it
- 60 thousand businesses (approx.)
- Audience in plain numbers
- 60,000 users or devices
- Normal peak
- ≈ 30 requests per second
- Request mix
- Notification: 40%; Analytics event: 35%; Write: 10%; Read: 15%
- Speed for 99 of 100 requests
- Write: ≈ 500 ms; Read: ≈ 500 ms
- Successful requests
- 99.9%
- Data safety
- No acknowledged write may be lost.
- Monthly budget
- ≈ $140,000
- Data at rest
- ≈ 5 TB
- Where users are
- North America: 60%; Europe: 30%; Asia Pacific: 10%
- Home region
- North America
- Waiting deadlines
- Notification: 900 seconds; Analytics event: 3,600 seconds; Write: 3,600 seconds; Read: 900 seconds
- Required proofs
- Audit trail
≈ marks an approximation, just as in the game. Waiting deadlines measure the age of queued work and are separate from interactive response time.
- Carrier throughput is fixed. Estimate peak sending rate before sizing the queue.
- Each text costs about a cent, so a repeated send is a visible bill (approx.).
- All numbers are rough approximations.
- 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 a campaign take a few minutes to finish?
Yes, within its window. Sending slower than the carrier allows is fine. Sending faster gets you blocked.
Can a phone get the same text twice?
No. Retries after a carrier timeout must not send it again, and a repeat is real money wasted.
What about people who texted STOP?
They must be checked before every send, and the check is audited. One wrong text can be a legal problem.
Do receipts have to be instant?
No. A few minutes is fine, but none may be lost or counted twice.
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.
09: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 70% of its configured quota. Duration: ≈ 1,200 seconds.
12:00 · Duplicate delivery
The queue redelivers messages. Without duplicate protection, side effects may be applied twice.
Affected share: 3%. Duration: ≈ 3,600 seconds.
16:00 · Poison message
One malformed message crashes every worker that picks it up, again and again.
Lasts until detected and repaired.
What a strong design has to handle
- The carrier sets the speed, not you. What holds the work while it waits, and what makes a retry safe?
- Honor opt-outs at send time and reconcile billable carrier submissions.
- Sending at the carrier pace protects the account, but a huge campaign takes minutes instead of seconds.
- Checking consent before every send is slower than checking once per campaign, and it is the only way STOP is honoured at once.
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
Concert ticket drop
Tickets for a huge tour go on sale at 10:00 sharp. Hundreds of thousands of fans arrive in the same minute, bots arrive earlier, and everyone refreshes when the page stalls. There are 40,000 seats. Sell each one once, charge each buyer once, and keep the site standing.
- Easy
One-time code by text
Apps ask you to send a six-digit code to a phone. The code must arrive in seconds, a person must never get it twice, and nobody may use your system to spam a number. Texts go through a carrier partner with a hard speed limit and a real price per message.
- 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.
- Hard
Scheduled job service
Customers register jobs: "call my web address every night at 02:00" or "every hour on the hour". Aim to fire within 5 seconds; work still waiting after 60 seconds counts as failed. Retry safely after a crash. One external effect requires the customer endpoint to honor a stable job occurrence key. Half the world picks the top of the hour, so a huge crowd of jobs comes due in the same second.