Skip to content

← Interview Arena

Design a notification system

Design a notification system

The Arena needs JavaScript to run an interview.

Design a notification system that sends push messages, emails and SMS to users on behalf of other services in the company. Work through the stages in order, as you would on a whiteboard: requirements, numbers, architecture, scaling, consistency, reliability, failure and trade-offs.

Key facts

Volume
250 million notifications a day
Peak
Assume the busiest moment is 3 times the average
Channel mix
For each 100 notifications: 75 push messages, 30 emails and 5 SMS messages (some users receive two channels)
Provider limits
Push 11,000 a second. Email 800 a second from the first provider (a second provider, if you add one, accepts 3,200). SMS 300 a second.
Time with a provider
A push call takes about 60 ms, an email 200 ms and an SMS 400 ms. Your own work for a notification is about 3 ms.
Preferences
Read once for each notification, changed a few times a year. One preferences database answers about 800 reads a second.
Delivery record
About 200 bytes for each message sent, kept for 30 days

Constraints

  • Templates, translation, scheduling and in-app inboxes are out of scope.
  • Some notifications, such as one-time codes, are urgent.
  • In the Architecture Builder a request is one notification submitted by a producing service, so the workload is almost all writes.
  • The service runs in one region. The figures are illustrative targets for this exercise, not measurements of real providers.

Suggested time per stage

  1. Requirements05:00
  2. Estimation06:00
  3. Architecture10:00
  4. Scaling06:00
  5. Consistency04:00
  6. Reliability04:00
  7. Failure scenarios05:00
  8. Trade-offs05:00
Mode

You can pause the clock, nothing is locked, and running out of time is only shown.

The clock cannot be paused. At zero, the stage you are on is locked as written and the stages after it score zero.

Length

Built by GhaziAlibi.

© ShardCraft. All rights reserved.