Push data to clients across multiple channels โ in-app, push notifications, email, SMS. Fan-out at scale, user preferences, rate limiting, and delivery guarantees.
Medium Medium-High FrequencyA notification system pushes data to users across multiple channels without them explicitly requesting it. The core challenge is fan-out at scale, multi-channel delivery, and respecting user preferences.
Persistent bidirectional connection (WebSocket) or server-to-client stream (SSE). Instant delivery when app is open. Each connection = memory + file descriptor on server. 1M connections = dedicated connection servers.
OS-level channel via APNs (iOS) or FCM (Android). Delivered even when app is closed. Best-effort delivery โ not guaranteed. Use as a hint; client fetches actual data via API.
When a post gets 1M likes, you don't send 1M push notifications to the author. Use aggregation: "X and 999,999 others liked your photo." Batch similar notifications within a time window (30-60 seconds) before delivering.
Push vs Pull vs Hybrid: Pure push (WebSocket) is instant but requires maintaining millions of persistent connections. Pure pull (polling) wastes resources. Best approach: push when online (instant) + push notification as wake-up signal when offline (no polling).
Aggregation window: Send immediately (good UX for 1:1 messages) vs batch and aggregate (good for high-volume events like likes). Solution: categorize by priority. Messages = instant. Likes = aggregate over 30s. Marketing = batch hourly.
Per-user rate limiting: No notification spam. Limit to N notifications per hour per user per channel. Priority queue: critical (payment confirmation) > social (likes) > marketing (recommendations).
At-least-once vs at-most-once: Push notifications are best-effort (at-most-once from OS perspective). For critical notifications (payment, security), use multiple channels + confirmation tracking. Don't rely on a single channel for important data.
Notification systems appear in almost every social/commerce/communication system design.
Interview signal: Structure notifications as a multi-channel problem. Mention fan-out, aggregation, rate limiting per user, and delivery guarantees unprompted.
| Metric | Value |
|---|---|
| WebSocket connections per server | ~1M concurrent (C10M) |
| WhatsApp message delivery (online) | ~50 ms p50 |
| WhatsApp message delivery (offline โ push) | ~5 seconds p99 |
| WhatsApp daily messages | ~100B messages/day โ 1.15M/sec |
| Push notification volume (WhatsApp) | ~30B push/day |
| Connection servers needed (2B users) | ~2,000 servers |
| Aggregation window (likes) | 30โ60 seconds |
| SMS cost (Twilio) | ~$0.0075/message |