What it is
A message queue stores units of work until consumers are ready to process them. Producers enqueue messages, consumers dequeue and handle them, and the queue provides buffering between the two.
Why it matters
Queues decouple slow or unreliable work from user-facing requests. They smooth traffic spikes, enable retries, and let workers scale independently from the API.
How it works
A producer publishes a message with a payload and metadata. A worker claims it, processes it, and acknowledges completion. If the worker fails, the message can become visible again or move to a dead-letter queue.
The queue keeps a message invisible to other workers while one is processing it. If the worker crashes or times out without acknowledging, the message becomes visible again for redelivery. Messages that exceed a retry limit move to a dead-letter queue for inspection.
When to use it
Use queues for emails, webhooks, media processing, fan-out, notifications, imports, and anything too slow for the request path.
Tradeoffs / failure modes
Queues introduce eventual consistency, duplicate delivery, ordering questions, and backlogs. Consumers should be idempotent.
Tiny example
After a video upload, the API enqueues a transcode job and returns immediately while workers create HLS renditions.
Related guides and systems
See Job Queues, Webhooks, File Upload Pipeline, Push Notifications, WhatsApp, Instagram, YouTube, Gmail, and GitHub.
Seen in deeper dives
Capability
File Upload Pipeline
Chunked and resumable uploads, server-side processing, and CDN delivery at scale
Capability
Job Queues & Background Workers
Async task processing with retries, dead-letter queues, and priority scheduling
Capability
Push Notifications
Fan-out delivery to APNs and FCM with guarantees, batching, and user preferences
Capability
Webhooks
Reliable event delivery to external systems with retry, HMAC verification, and monitoring
Case Study
GitHub
The world's largest code hosting platform powered by Git at scale
Case Study
Gmail
The world's largest email service with AI-powered organization and search
Case Study
Photo and video sharing at massive scale with real-time feeds
Case Study
End-to-end encrypted messaging at planetary scale
Case Study
YouTube
The world's largest video platform serving billions of hours daily
Related concepts
API Gateway
A controlled front door for authentication, routing, rate limits, and API policy.
Backpressure
Slow producers down when consumers cannot keep up.
Circuit Breaker
Stop calling an unhealthy dependency before failures cascade through the system.