Design a notification system that sends 50 million messages a day across email, SMS and push.
A notification system at 50 million a day is sized by bursts and provider limits, not its average of about 580 a second. Accept with an idempotency key, apply preferences once, fan out to per-channel queues with transactional and bulk lanes, rate-limit each provider, and never fail over blindly on a timeout.
Answer
Short answer
Size it by the bursts, not the average. A notification system at 50 million a day averages about 580 messages a second, but one campaign can demand ten times that. The shape is an API that accepts requests with an idempotency key, a router that applies preferences and templates once, per-channel queues split into transactional and bulk lanes, and channel workers that respect each provider's rate limit and record every attempt. Failover between providers is where duplicates come from, so it has to be keyed.
Was this answer helpful?
Likely follow-ups
- A campaign to ten million users is half sent when marketing spots a wrong link. How do you stop the rest, and what about the half already queued at the provider?
- How do you keep the delivery-status table useful when providers send their receipts hours late, out of order, or twice?
- A push token stops working after a user reinstalls the app. How does the system find out, and what does it do with the token?
- How would you guarantee a password-reset email goes out within seconds while a twenty-million-recipient newsletter is draining?
Related questions
- You must ingest all of English Wikipedia every day, and the source does not want to be hammered. What runs, how often, and what do you do about the run that fails at hour six?hardAlso on rate-limiting and idempotency6 min
- What is the difference between a queue and a log, and what does a broker mean when it claims exactly-once?hardAlso on message-queues and idempotency6 min
- Design the home feed for a social network.hardAlso on fan-out8 min
- Design ticketing for a 60,000-seat stadium where every seat goes on sale at 10am. How do you sell each seat exactly once?hardAlso on idempotency7 min