support different apps in mobile application
performance monitoring
message targeting: user preference, based on user behavior, user segment(location, demographics, etc)
delivery schedule: timezone, frequency, after some event
personalization notification
localization
user engagement tracking
reusability
multi-tenancy
high performance
reliability
scalability
known metrics:
100K notifications per second in peak, 115 in normal
1s e2e latency
5s of scheduled time
delivery rate 95%
notification open rate 20%~30%
error rate 2%
meesage payload length avg: 2k
QPS:
peak
100K, considering each instance send 10K, need 10 worker instance
non peak
115, need 1 worker
-- need auto scaling policy, talk later
networkband width:
peak 100K * 2K = 200M
non peak
115 * 2K = 200K
disk:
1 year of storage
115 * 24 * 3600 * 365 * 2K = 7253G = 7T storage
replica = 3, total 21T
/send_notification, title, payload, receiver_id, device_type
return OK/NOT OK
/notification/history?receiver_id
return [notifcation_id, notification_payload, timestamp]
/user/preferences?receiver_id
return [recommend notification_id]
noSQL db
key=payload_id
value = payload
kafka
seperate topic for each destination(APn, fcm, http)
message_id = payload_id
value = payload
Database: PostgreSQL for user data and schedules; Redis or DynamoDB for fast lookups and caching.
You should identify enough components that are needed to solve the actual problem from end to end. Also remember to draw a block diagram using the diagramming tool to augment your design. If you are unfamiliar with the tool, you can simply describe your design to the chat bot and ask it to generate a starter diagram for you to modify...
Message Creation and Personalization:
Scheduling and Queuing:
Notification Delivery:
Monitoring and Feedback:
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
A/B testing
GDPR when storing PII
user activity reporting loop
API Gateway
Scheduler
Worker Pool
Notification Delivery Service
Monitoring & Analytics
Database: Use PostgreSQL for relational data (schedules) and Redis for fast access to real-time preferences.
Queue System: Kafka for high-throughput, fault-tolerant message processing.
Worker Scaling: Kubernetes-based auto-scaling ensures dynamic capacity.
Personalization & Localization: Preprocess personalized content to avoid runtime delays.
Delivery Guarantees: Use exponential backoff for retries to manage failure scenarios.
Database Bottleneck: Redis caching can reduce read pressure on the primary database.
Queue Overload: Rate limiting at the API level prevents message spikes.
Notification Delivery Failure: Implement retry logic and fallback mechanisms.
Scheduler Delay: Optimize with sharded scheduling to parallelize message dispatch.
auto scaling for peak/non peak
machine learning process: separate recall and ranking
separate FCM workers to APN workers
backend server send to influx
have a calibration between backend servers to monitoring any data loss/duplication
Machine Learning for Targeting: Improve message targeting based on user behavior patterns.
Multilingual Support: Expand localization to handle more languages.
Real-time Analytics: Use streaming solutions like Apache Flink for near-real-time user engagement tracking.
A/B Testing: Experiment with different message formats to improve open rates.