Architectural Breakdown & AnalysisFAANG Aligned
Building a system to push millions of mobile/web notifications per minute requires decoupled asynchronous processing pipelines.
Architecture Flow
- API Ingestion: Accepts notification triggers, assigns priority queues (Transactional vs. Promotional).
- User Device Registry: Resolves user IDs to device tokens (iOS APNs / Android FCM tokens) using a partitioned DB.
- Message Fan-Out Queue (Kafka): Pushes message payloads to Kafka topic partitions distributed by device token hash.
- Worker Clusters: Async workers batch requests to Apple APNs and Google FCM HTTP/2 push endpoints.
NOTE — Idempotency & De-duplication
Assign a unique notification_id to prevent duplicate pushes if notification workers retry failed APNs/FCM connections.
Key Architectural Comparison
| Push Channel | Protocol | Latency SLA | Cost per Message | Delivery Reliability |
|---|---|---|---|---|
| Apple APNs / Google FCM | HTTP/2 Persistent Stream | $< 500\text{ms}$ | Free | Best-effort (Requires device connection). |
| SMS (Twilio / Sinch) | Telephony SS7 / SMPP | 2–5 seconds | High ($0.01–$0.05/msg) | High (Guaranteed delivery network). |
| Email (SendGrid / SES) | SMTP over TLS | 5–60 seconds | Very Low ($0.10/1k msgs) | Subject to spam folder filters. |