| Users | Push Requests/Second | Message Volume | Infrastructure Changes |
|---|---|---|---|
| 100 users | ~10 req/s | Low volume, simple queue | Single server, basic push service |
| 10,000 users | ~1,000 req/s | Moderate volume, queue grows | Load balancer, multiple push workers, caching |
| 1,000,000 users | ~100,000 req/s | High volume, large queues | Distributed push services, sharded queues, CDN for payloads |
| 100,000,000 users | ~10,000,000 req/s | Very high volume, massive queues | Multi-region clusters, advanced sharding, edge caching, auto-scaling |
Push notification integration in HLD - Scalability & System Analysis
Start learning this pattern below
Jump into concepts and practice - no test required
The first bottleneck is the message queue and push service throughput. As user count grows, the system struggles to enqueue and deliver notifications fast enough. Single servers and simple queues cannot handle high concurrent push requests, causing delays and dropped messages.
- Horizontal scaling: Add more push worker servers behind a load balancer to distribute load.
- Message queue sharding: Split queues by user segments or notification types to reduce contention.
- Caching: Cache notification payloads or user tokens to reduce repeated database lookups.
- Use CDN: For large payloads like images, use CDN to offload delivery from push servers.
- Auto-scaling: Automatically add/remove push workers based on traffic spikes.
- Multi-region deployment: Deploy push services closer to users to reduce latency and network load.
At 1 million users sending 1 notification per second, expect ~1 million push requests per second. Each request is small (~1 KB), so bandwidth is about 1 GB/s. Storage for logs and retries can grow to terabytes daily. Infrastructure costs include multiple servers, message queues, and CDN usage. Efficient batching and filtering reduce costs.
Start by explaining the push flow simply: app server sends notification to queue, workers deliver to devices. Discuss bottlenecks like queue throughput and network limits. Then propose scaling steps: horizontal scaling, sharding, caching, CDN. Always justify why each step solves the bottleneck.
Your database handles 1000 QPS. Traffic grows 10x to 10,000 QPS. What do you do first?
Answer: Add read replicas and implement caching to reduce load on the main database before scaling application servers.
Practice
Solution
Step 1: Understand push notification purpose
Push notifications are messages sent to users to keep them informed or engaged.Step 2: Identify correct purpose in options
Only To keep users updated even when the app is closed correctly states that notifications keep users updated even when app is closed.Final Answer:
To keep users updated even when the app is closed -> Option AQuick Check:
Push notifications = keep users updated [OK]
- Thinking notifications increase app size
- Believing notifications slow app down
- Assuming notifications disable interaction
Solution
Step 1: Identify standard permission request method
Common method names include 'requestPermissionForNotifications' to ask user consent.Step 2: Compare options for correct syntax
requestPermissionForNotifications(); uses a clear, standard naming pattern for requesting permission.Final Answer:
requestPermissionForNotifications(); -> Option DQuick Check:
Permission request method = requestPermissionForNotifications() [OK]
- Using method names that don't request permission
- Confusing enabling notifications with requesting permission
- Using non-standard or undefined method names
onNotificationReceived(notification) {
if (notification.type === 'message') {
showAlert(notification.title);
}
}
What happens when a notification with type 'message' arrives?Solution
Step 1: Analyze the notification type check
The code checks if notification.type equals 'message'.Step 2: Understand the action on matching type
If true, it calls showAlert with notification.title, displaying an alert.Final Answer:
An alert with the notification title is shown -> Option AQuick Check:
Type 'message' triggers alert display [OK]
- Assuming notification is ignored
- Thinking app crashes without error
- Confusing logging with alert display
function handleNotification(notification) {
if notification.isRead = false {
displayNotification(notification);
}
}Solution
Step 1: Check the if condition syntax
The condition uses '=' which assigns value instead of comparing.Step 2: Identify correct comparison operator
It should use '==' or '===' to compare values, not '='.Final Answer:
Using assignment '=' instead of comparison '==' in if condition -> Option BQuick Check:
Use '==' for comparison, not '=' [OK]
- Confusing assignment and comparison operators
- Ignoring syntax errors in if statements
- Assuming function name causes error
Solution
Step 1: Understand conditions for sending notification
Notification should send only if permission is granted AND app is in background.Step 2: Evaluate logical operators in options
if (userPermissionGranted && appState === 'background') { sendPushNotification(); } uses '&&' (AND) correctly to check both conditions.Final Answer:
if (userPermissionGranted && appState === 'background') { sendPushNotification(); } -> Option CQuick Check:
Use AND (&&) to require both conditions [OK]
- Using OR (||) instead of AND (&&)
- Negating permission incorrectly
- Checking wrong app state
