Skip to content

What it is

A queue is a buffer that holds messages or tasks in order until a consumer processes them, decoupling producers from consumers in distributed systems.

A queue is a data structure and a communication pattern. As a data structure, it is a first-in-first-out list: items enter at the tail and leave at the head. As a pattern, it sits between two independent processes — a producer that emits messages and a consumer that processes them — and holds the messages until the consumer is ready. The producer does not need to know which consumer will process the message, whether the consumer is running, or how fast it processes. The consumer does not need to know how many producers exist or how bursty they are. The queue absorbs the difference in pace between the two sides.

In modern infrastructure, "queue" almost always refers to a message queue system: RabbitMQ, AWS SQS, Apache Kafka, Google Pub/Sub, Redis Streams, ActiveMQ. Each has its own guarantees about delivery (at-most-once, at-least-once, exactly-once), ordering, and durability, but all of them solve the same structural problem. A task queue (Celery, Sidekiq, BullMQ) is a specialization: instead of raw messages, it carries jobs — references to a handler plus arguments — and runs them in a separate worker process.