🛠️ TalentMe · System Design DISTRIBUTED ARCHITECTURE TEARDOWN

[System Design] Fault-Tolerant Global Notification Engine: 1M QPS Multi-Channel Delivery

✍️ TalentMe Architecture Group
📅
⏱️ 5 min read
📊 833 words
[System Design] Fault-Tolerant Global Notification Engine: 1M QPS Multi-Channel Delivery
ARCH CHALLENGE
Fault-Tolerant Global Notification Engine
TARGET SCALE
1M notifications/sec (1,000,000 QPS), P99 latency < 200ms, 99.99% SLA, 500M active users, 10B events/day
TARGET LEVEL
L5 / L6 (Senior / Staff)
CORE PILLARS
High Availability & Consistency

🧮 Back-of-the-Envelope Capacity Estimations

Traffic QPS
Ingestion: 1M QPS. Fan-out: 1M QPS to queue. Downstream: 800K QPS to FCM/APNs, 100K QPS to SMS, 100K QPS to Email.
Storage Growth
1M/sec * 86400 sec * 365 days * 500 bytes/event = ~15.3 TB/year raw. With 30-day retention and 3x replication, ~137 TB active storage.
Memory / Cache (80/20)
80/20 rule: 20% of users (100M) generate 80% of traffic. Cache user fatigue state (1KB/user) = 100GB RAM. Cache dedup keys (100M keys * 100 bytes) = 10GB RAM.
Bandwidth In/Out
Ingress: 1M/sec * 500 bytes = 500 MB/s. Egress: 1M/sec * 500 bytes = 500 MB/s. Total: 1 Gbps sustained.

📐 High-Level Architecture Topology

flowchart TD
  A[Client/Service] --> B[API Gateway]
  B --> C[Ingestion Service]
  C --> D[Priority Queue]
  D --> E[Worker Pool]
  E --> F[Rules Engine]
  F --> G[FCM/APNs]
  F --> H[SMS]
  F --> I[Email]
  G --> J[DLQ]
  H --> J
  I --> J
  J --> K[Retry Service]
    

🏛️ Architecture Deep Dive & Component Topology

Ingestion & Queueing

The system ingests 1M notifications/sec via a stateless API Gateway that validates payloads and assigns a unique idempotency key (UUID + user_id + event_type). Events are published to a distributed priority queue (e.g., Kafka with priority topics or Redis Streams with priority scores). High-priority events (e.g., security alerts) are routed to dedicated partitions to avoid head-of-line blocking.

Rules Engine & Fatigue Capping

Before dispatch, a stateful rules engine evaluates user fatigue rules (e.g., max 5 notifications/hour). This engine uses a distributed cache (Redis) to store user state, with a write-through policy to a persistent store (Cassandra) for durability. Rules are versioned and hot-reloaded via a config service.

Dispatch & Provider Health

Workers consume from the queue and dispatch to downstream providers (FCM, APNs, SMS, Email). Each provider is wrapped in a circuit breaker (Hystrix/Resilience4j) that opens on >50% failure rate over 10 seconds. Failed events are routed to a Dead Letter Queue (DLQ) for asynchronous retry with exponential backoff.

Deduplication

Idempotency is enforced via a distributed bloom filter (Cassandra) storing recent idempotency keys. On duplicate detection, the event is dropped and logged. This ensures at-least-once delivery without user-visible duplicates.

💾 Data Models (DDL/Schemas) & API Contracts

CREATE TABLE notifications (
  idempotency_key TEXT PRIMARY KEY,
  user_id UUID,
  event_type TEXT,
  payload JSONB,
  priority INT,
  created_at TIMESTAMP,
  status TEXT
);

CREATE TABLE user_fatigue (
  user_id UUID PRIMARY KEY,
  last_notification_time TIMESTAMP,
  notification_count_hour INT,
  updated_at TIMESTAMP
);

-- REST API
POST /v1/notifications
{
  "idempotency_key": "uuid",
  "user_id": "uuid",
  "event_type": "order_shipped",
  "payload": {"order_id": "123"},
  "priority": 1
}

-- gRPC Service
service NotificationService {
  rpc SendNotification (NotificationRequest) returns (NotificationResponse);
}

🛡️ Extreme Failure Scenarios, Stampede Defense & Self-Healing

Split-Brain & Consistency

In a multi-region deployment, user fatigue state must be consistent to prevent over-notification. Use a CRDT (Conflict-free Replicated Data Type) for fatigue counters to handle concurrent updates. If a split-brain occurs, the system favors safety (drop notifications) over liveness to avoid user fatigue.

Cache Stampede

When a popular user’s fatigue state expires, multiple workers may simultaneously fetch from the database. Mitigate with request coalescing (single-flight pattern) and jittered TTLs to spread load.

Disaster Recovery

Implement active-active multi-region with geo-redundant queues. If a region fails, traffic is rerouted via DNS failover. DLQs are replicated across regions to ensure no event loss. Circuit breakers are tuned per region to prevent cascading failures.

Provider Outages

If FCM is down, events are queued in a local buffer (with TTL) and retried. If the buffer fills, events are dropped and logged for audit. This prevents backpressure from propagating to the ingestion layer.

🎯 Interview Evaluation Rubric: L4/Senior vs L6/Staff Architect

L4 / Senior Engineer Baseline
Proposes a standard microservices architecture with a message queue (Kafka) and workers. Implements basic caching for user state. Mentions circuit breakers but lacks detail on tuning. Does not address multi-region consistency or CRDTs. DLQ is mentioned but retry logic is simplistic.

L6 / Staff Architect Differentiators
Designs a multi-region active-active system with CRDTs for fatigue state. Implements request coalescing to prevent cache stampede. Details circuit breaker tuning (failure rate, window size) and DLQ retry with exponential backoff. Addresses head-of-line blocking with priority partitions. Considers cost optimization by tiering storage (hot/warm/cold) and using serverless for DLQ processing.

📺 YOUTUBE MASTERCLASS

🎬 Visual Teardown: High Availability vs Fault Tolerance vs DR (Part 2/8) #Shorts


Watch on YouTube ↗

💡 Key Study Takeaway:ByteByteGo high-frequency FAANG system design teardown of location-based services exploring GeoHash vs QuadTree.
🧭 Master FAANG System Design on TalentMe
Access 69+ production-grade algorithm breakdowns, distributed architecture simulations, and mock interviews.


🚀 Launch TalentMe Architecture Workbench →

SPONSORED PARTNER · 合作伙伴推荐
🛍️ Recommended Gear & Custom Amazon Search for This Topic🔥 4 Curated Picks + Custom Search
⚖️ AirSOTA is a participant in the Amazon Services LLC Associates Program. As an Amazon Associate, we earn from qualifying purchases at no extra cost to you.
探索更多优质技术与商业专栏
返回 💻 大厂系统设计与架构 (System Design Pulse) 专栏或浏览 AirSOTA 知识矩阵

⚡ WEEKLY SOTA DIGEST · DIRECT TO INBOX
📬 Get the AirSOTA Weekly SOTA Briefing (Zero Spam, Unsubscribe Anytime)

Join engineers, parents, and investors receiving our Friday synthesis of AI kernels, AAP baby recipes, and US real estate & S&P 500 deep dives.

🌐 AirSOTA Cross-Domain Ecosystem Synergy

Empowering North American tech talent & families with integrated decision-making across Visa, Career, Wealth, Housing & Education.


Discover more from AirSOTA – Air School Of Thoughts AtoZ

Subscribe to get the latest posts sent to your email.

🏠 首页 | ← TalentMe |