Please enable JavaScript.
Coggle requires JavaScript to display documents.
Design a notification system - Coggle Diagram
Design a notification system
Types of notifications
iOS push notification
A provider builds and sends notification requests to Apple Push Notification Service (APNS)
Notification
Device token
Payload
Android push notification
Firebase Cloud Messaging (FCM)
SMS message
Email
Contact info
To send notifications, we need to gather mobile device tokens, phone numbers, or email addresses
A user can have multiple devices
Simple Design
Many services use one notification system
The notification call third parties service
Third parties services
APNs
FCM
SMS Services
Email Service
Problems
Single point of failure (SPOF)
Hard to scale
Performance bottleneck
Improved Design
Services use API provided by notification servers
Notification servers
Multiple servers
Query the database or cache to fetch data needed to render a notification
Put notification data to message queues for parallel processing
Cache
User info, device info, notification templates are cached
DB
It stores data about user, notification, settings, etc
Message queues
Each notification type is assigned with a distinct message queue
Workers
Workers are a list of servers that pull notification events from message queues and send them to the corresponding third-party services.
Additionals
Notification template
Notification setting
Rate limiting
Retry mechanism
Security in push notifications
Monitor queued notifications
Events tracking