Nâng CaoSystem Design iconSystem Design

Thiết kế hệ thống Notification (push/email/SMS notifications). Các thành phần và đảm bảo delivery? (Design a Notification System (push/email/SMS). Components and ensuring delivery?)

Requirements: multi-channel (push, email, SMS), high volume (hàng trăm triệu notifications/day), reliable delivery, user preferences.

Architecture: Producer Services → Notification Service → Channel Handlers → Third-party providers.

  • Notification Service: nhận events (order shipped, friend request), lookup user preferences (channel, quiet hours, opt-out), enqueue vào Kafka với separate topics per channel.
  • Channel Workers: Push Notification Worker gọi FCM (Android)/APNs (iOS); Email Worker gọi SendGrid/SES; SMS Worker gọi Twilio/SNS.
  • Reliability: at-least-once delivery via Kafka; lưu notification vào DB với status (pending/sent/failed); retry with exponential backoff; dead letter queue cho permanent failures.
  • Rate limiting per user: không spam user với 100 notifications cùng lúc – aggregate/throttle.
  • Notification template service: versioned templates với i18n support.
  • User preference service: per-channel opt-in/out, quiet hours, digest mode.
  • Monitoring: delivery rate per channel, bounce/unsubscribe tracking, latency P99.

Scale bottleneck thường ở third-party API calls – cần circuit breakers và fallback providers. Idempotency key để tránh duplicate notifications khi retry.

Xem toàn bộ System Design cùng filter theo level & chủ đề con.

Mở danh sách System Design