Design a horizontally scalable push notification service in Go
go-sys-001
Your answer
Answer as you would in a real interview — explain your thinking, not just the conclusion.
Model answer
I would split the system into an API layer that accepts notification requests and a delivery layer that fans out to push providers (APNs, FCM). The API layer enqueues jobs to Kafka, decoupled from delivery. Each delivery worker is a Go service consuming from a Kafka consumer group: it resolves device tokens from a registry (PostgreSQL + Redis cache), then dispatches to the push provider in goroutines with per-provider rate limiting via golang.org/x/time/rate. Horizontal scaling is achieved by adding consumer group members; partitioning by user ID ensures in-order delivery per user. Stale or unregistered device tokens returned by APNs/FCM are deleted from the registry immediately to avoid wasted future sends. Observability: Prometheus gauges for consumer lag, histograms for delivery latency by provider.
Follow-up
How would you handle a 10-million-user broadcast notification (e.g. breaking news) within 60 seconds?