Push Notification Pipeline
Notifications for 2M+ combined users without taking the server down.
- Role
- Designed and built
- Metric
- 2M+ combined users
- Stack
-
- Python
- Celery
- Redis
- PostgreSQL
- Firebase Cloud Messaging
The problem
Notifications were sent by looping over users inside the API request. Under heavy traffic the request blocked, the server sometimes crashed, and Firebase rejected bursts with too-many-requests errors.
The design
- 01
The API stores the job in a queue and immediately responds that the schedule is set.
- 02
Celery workers on Redis, backed by PostgreSQL, drain the queue.
- 03
Under heavy traffic, more workers are added; when it drops, workers are reduced.
Also on this page
Order API 1.2s → 0.4s via query optimization, PostgreSQL indexing and caching.
- slow query
- missing index
- no cache
Key decisions
-
A queue instead of more servers: cheaper, and it absorbs spikes instead of failing under them.
-
Respond first, send later: the caller gets an answer in milliseconds regardless of audience size.
-
Scale workers, not the API: capacity follows load, and the web tier stays fast for shoppers.
Result
The API never blocks. A traffic spike makes the queue longer instead of crashing the server.