[SysDes1][Chap. 10] Design a Notification System

Design Questions

  • Different forms of notification systems: Mobile push notification, SMS message, Email.
  • What triggers notifications? Both client applications and scheduled job on the server-side.
  • We should allow users to opt out.

Different types of notification

  • IOS push notification: send requests to Apple Push Notification (APN) servers.
  • Android push notification: send requests to Firebase Cloud Messaging (FCM) servers.
  • SMS messages: third party services e.g. Twillo, Nexmo.
  • Emails: third party services e.g. Sendgrid, Mailchimp.

CUJ: Contact info gathering flow

  1. Users login API server
  2. API server read/write contact info in Database.

CUJ: Notification sending/receiving flo

  • Design point: to make server stateless, move DB and Cache out of notification servers
  • Design point: to decouple system components, use different message queues for different notification types
  1. Notification servers serve online notification requests and fan out message to message queues
  2. Notification servers periodically run the scheduled offline job to send message to message queues

Other topics

  • How to prevent data loss? Write operations to log.
  • Will notification be delivered exactly once? No, but we can deduplicate by event id etc.
  • Allow notification template: It will provide more flexibility for users to control and it can reduce request size.
  • Rate limiting / Politeness: Limit the number of notification a user can receive.
  • Monitoring: Monitor some key metrics, e.g. the total number of queued notifications, the maximum latency of delivery etc.
  • Analytics: Collect and analyze some key metrics, e.g. open rate, click rate, engagement rate.

Leave a Reply

Your email address will not be published. Required fields are marked *