Notifications
0-day streakReview

Your progress

Level 1

0 XP100 XP to level 2
0day streak
0best streak
0topics started
0cards reviewed
    Review cards

    Progress is stored only in this browser. No account is required.

    Design a notification system: the 60-second story

    Design a notification system

    Your OTP and a sale to 100 million phones share the same pipes.

    One platform sends push, SMS, email and inbox items for every team of a 300-million-user super-app.

    3B

    notifications a day, for 300M users

    1B transactional that must land in seconds, 2B from campaigns that can take minutes. Transactional alone peaks near 50k a second.

    Where does your OTP wait?

    Bad: One SMS queue

    Behind 20M sale SMS at 10k/s: 2,000 s. It expires in 5 minutes.

    Good: Its own lane

    sms.p0: own workers, reserved SMS capacity. It waits milliseconds.

    5.7×

    FCM’s default allowance, for one campaign

    100M users in 30 minutes is 3.4M FCM sends a minute; the default is 600k. Every order update shares the same allowance.

    100M pushes: all at once, or paced?

    All at once ends ten minutes sooner by spending the quota order updates need. Paced at 55k/s, it ends at minute 31.

    Expand 100M users at once and a cancel must purge 100M queued messages.

    The trick

    Release 10k-user chunks only as fast as you send. Cancel stops the releases: about 50k users in flight.

    FCM said 200 OK, then the worker crashed. Send again?

    Nobody recorded it, so exactly-once to a phone is impossible. Each type decides. An OTP is never resent; a receipt retries with a collapse ID.

    No loss, rare duplicates

    1. Producer: outbox row in the same transaction
    2. API: idempotency key, same ID on retry
    3. Worker: dedupe key in Redis before sending
    4. Retries end at the type’s TTL

    Remember

    Accept durably, decide once per user, send through lanes by priority and channel. Priority comes from the type, with its own workers and quota, so an OTP never waits behind a campaign.