Prompt
Why are my push notifications delayed in my backend service?
Latest observation
Nov 4, 2026
OpenAI APIWeb search: off
Delayed push notifications in a backend service usually come from one of a few common bottlenecks. Here are the most likely causes, grouped by layer:
1) Your backend is queuing or processing slowly
- Single-threaded or overloaded workers: If notification jobs are handled serially, they can back up.
- Queue latency: If you use a queue (Sidekiq, Celery, SQS, Bull, etc.), jobs may sit waiting because there aren’t enough consumers.
- Retry storms: Failed pushes being retried can delay later notifications.
- Synchronous send path: If your API request waits for the push provider call, slow provider responses can slow everything down.
2) Push provider delays
- FCM/APNs/APNS sandbox delays: Providers can occasionally be slow.
- Rate limiting / throttling: Sending too many notifications at once may cause provider-side throttling.
- Transient delivery delays: Push systems are not always instant; device/network conditions matter.
- Invalid tokens: Repeated attempts to deliver to dead tokens can waste time and increase latency.
3) Device-side reasons
- Doze / battery optimization (Android): The OS may delay delivery to save battery.
- Focus / Do Not Disturb: Notifications may be delivered but not shown immediately.
- Offline device: Notification is stored until the device reconnects.
- iOS background policies: Silent pushes and some background updates are heavily constrained.
4) Network and infrastructure issues
- DNS / connection pooling problems: New connections for every request can add overhead.
- High latency to push endpoints: Your servers may be in a region far from the provider endpoint.
- Firewall/proxy issues: Can add delays or intermittent timeouts.
5) App logic problems
- Time-based scheduling bugs: Cron/jobs misconfigured in UTC vs local time.
- Clock skew: Server time and queue timestamps don’t match.
- Deduplication logic: Notifications may be intentionally held to collapse duplicates.
- Batching: If you batch notifications for efficiency, users perceive delay.
What to check first
-
Measure timestamps at each step
Log:- event created
- job enqueued
- job started
- push API called
- provider response
- device received (if possible)
-
Check queue depth and worker utilization
- Are jobs piling up?
- Are workers busy or crashing?
-
Inspect provider responses
- Any 429s, 5xxs, timeouts, or throttling headers?
-
Test with a single notification
- If one message is fast but bursts are slow, it’s likely a throughput or rate-limit issue.
-
Verify device conditions
- Test on a device with no battery optimizations / focus mode.
Common fixes
- Increase worker count or scale consumers
- Use async/background jobs instead of sending inline
- Add connection pooling and reuse HTTP clients
- Implement exponential backoff for retries
- Remove or dead-letter invalid device tokens
- Batch intelligently, but don’t over-batch time-sensitive pushes
- Add observability around queue and provider latency
If you want, I can help you diagnose this more precisely if you share:
- your backend stack,
- which push provider you use (FCM/APNs/etc.),
- whether you send inline or via a queue,
- and a sample timeline/logs of one delayed notification.