EVOPEDIA

← all systems · see it in The System

Message queue and work queue

boundaryInside: the producers' hand-off (publish), the broker or queue manager with its exchanges, bindings and stored queues, the dispatch to competing workers with leases, acknowledgements, redelivery, delivery limits and dead-letter queues, the workers' side of the contract (acknowledging after the work, idempotence), and the replication among broker nodes. Outside: the network and operating system that carry it, the disks and memory it is stored in, the database it may be built on, the applications' own business logic, the operators, and the cloud that sells it. Whether a distributed log (event streaming) is inside the kind is contested (C-4590).
nested levelRung 12 technology: built from brokers, queues and worker pools on networks, memory and disks; one part of message-oriented middleware, of operating systems (inter-process queues) and of applications in the cloud; carried by people who configure it and write its consumers.
scaletechnological

From the walk

A message queue cannot by itself promise that a job happens exactly once. If the worker says 'done' before doing the job, a crash loses it; if after, a crash repeats it. The way out is to save the 'done' and the job's result together in one transaction, as transaction-processing queues do; but that is not commonly available, because the messaging and the database are often separate systems, and then the promise you can count on, as one engineer put it, is delivery 'zero or more times', and workers are built to shrug off repeats (src:kingsbury-2014-rabbitmq; src:bernstein-1990; src:helland-2012).

Definition. In computer science, message queues and mailboxes are software-engineering components typically used for inter-process communication (IPC), or for inter-thread communication within the same process; they use a queue for messaging, the passing of control or of content. Walked as distributed-systems engineering describes it: producers hand work to a broker (a queue manager), the broker stores it, and a pool of competing workers takes items one at a time under acknowledgements and leases, with the delivery promises, failures and measured behaviour that come with it. Definition drawn from the encyclopedia entries listed under Sources (Wikipedia, CC BY-SA).

On this page: Properties 2 · Measures 31 · Open contentions 5 · Cross-scale patterns 23 · Valence partners 10 · Partners and parts 53 · Notes 3 · Layers 49 · Sources 44

Properties published scienceour proposal

Sourced fields, and our own readings.

born atabout 1965 (IMS, from Gray 1995: 30 years of experience); contested (C-4598)
born precision±10 years

Measures (31) published science

visibility timeout, default (Amazon SQS)30 s
visibility timeout, maximum (Amazon SQS)12 h from first receipt
in-flight message limit (Amazon SQS standard queue)about 120,000 messages
message retention (Amazon SQS)4 days by default; 60 s minimum; 14 days maximum
FIFO deduplication interval (Amazon SQS)5 min
SQS message size limit, history8 KB at first; 64 KB from 2010-07-01; 256 KB from 2013-06-18 bytes
acceptable backlog per instance (worked example)100 (= 10 s acceptable latency / 0.1 s per message) messages per instance
dead TCP connection detection, Linux defaultsabout 11 min
memory high watermark, default (RabbitMQ)0.6 fraction of RAM
flow-control cycle (RabbitMQ)several times a second block/unblock cycles
prefetch giving optimal throughput (RabbitMQ guidance)100-300 unacknowledged deliveries
prefetch cap (RabbitMQ quorum queues)2,000 unacknowledged deliveries
delivery limit, default (RabbitMQ quorum queues)20 (since 4.0; no limit before) deliveries
wait before returning messages of a disconnected consumer (RabbitMQ quorum queues)60 s
broker latency, RabbitMQ, medium loadbelow 10 ms
Kafka latency read from cache, 50th / 99.9th percentile1 / 15 (no replication); 1 / 30 (replication) ms
Kafka latency when reads go to diskup to about 100 ms
RabbitMQ cluster throughput (cited test)over 1.3 million messages per second (32 nodes, 186 queues, 13,000 clients)
latency rise under five times the clients (Kafka, survey testbed)about 100x latency; 29x drop in consumer throughput ratio
throughput cost of exactly-once processing (Kafka Streams)10-20 % of throughput, against at-least-once
acknowledged messages lost under partitions (Jepsen 2014)1312 of 3747 attempted enqueues (about 35% of acknowledged writes); 24 duplicates messages
dequeued per attempted enqueue under partitions (availability and loss mixed; Jepsen 2014)2358 / 3747 = 0.63 messages dequeued per attempted enqueue
acknowledged messages lost to simulated power failure (Jepsen 2025)131,418 of 930,005 (about thirty seconds of writes) messages
acknowledged messages lost to file corruption (Jepsen 2025)679,153 of 1,367,069 messages
flush interval, default (NATS JetStream, 2.12.1)2 min
retry-sustained load in the worked case560 (normal load 280) queries per second
load below which the worked system self-heals150 QPS load, or retries under 20 QPS queries per second
queue managers in one product (CICS)over six queue managers
years of queued processing experience by 199530 years
share of studied metastable incidents involving retry stormsover 50% of incidents
acquisition lock, default (Kafka share groups, KIP-932)30 s

Open contentions (5) open contention

Where sources or readings disagree. Both stay on the map.

Cross-scale patterns seen here (23) our proposal

Shapes that recur when the same kind of problem is solved at different scales, and how each shows in Message queue and work queue. Each links to every other system that shows it.

Valence: what it trades, and with whom (10) published science

Each exchange with a neighbour, read from both sides: who gains, who pays, and what carries it.

Partners and parts published science

Built from / builds (6)

Sits inside / holds (3)

expressed by (22)

floor filled by (13)

Kinds (9)

Notes published science

Layers

The ways it takes in its world, where they meet, and how it acts back, each from L1 (where it meets the world) up.

a message queue as distributed-systems engineers describe it: bytes on the network and the broker's disks, the protocol connection, routing into named queues, the stored queue, dispatch to competing workers under leases and acknowledgements, the delivery contract, and the decoupled work it carries (reader's view)

  1. L1: Bytes in flight between producers, broker and workers on the network, and the broker's bytes at rest on disk: frames being encoded, in TCP buffers, on the wire
  2. L2: The protocol connection: AMQP's wire-level frames over a TCP connection, with channels or sessions multiplexed on it and heartbeats to detect a dead peer; for cloud queues, HTTP requests
  3. L3: Routing and admission: an exchange matches each message against the bindings applications created, and hands it to the bound queues; an unroutable message is returned or dropped; publishers the queues cannot keep up with are slowed
  4. L4: The queue: messages waiting for a worker, kept in order of arrival within priority, per group, or not strictly in order at all; held in memory, on disk, in a database table, or replicated across a majority of nodes
  5. L5: Dispatch: each message handed to one of several competing workers under a lease (visibility timeout, an unacknowledged delivery tied to a channel, a locked row), with a cap on how many are in flight; acknowledgement, requeue, redelivery, poison-message limits and dead-lettering
  6. L6: The delivery contract: at most once, at least once, or a claimed exactly once; the order promised (none, within a partition or group, global); durability across restarts; a joint responsibility of the broker, the publishers and the consumers, with idempotent consumers as the usual answer to repeats
  7. L7: The decoupled work: producers and workers that need not run at the same time, the load shared among the workers and bursts absorbed; the applications' jobs carried this way (orders and billing, image processing, workflows, transaction requests)

the boardroom (shared floors)

  1. L4: The stored queue: messages waiting, in the order the kind of queue keeps, durable or not; every incoming channel ends by changing what is stored (a new message, a deletion, a message made visible again, an expiry, a replica agreed, a policy, a recovered file)
  2. L5: Dispatch and flow: which worker gets which message, how many may be in flight, when a lease is up, when a message has failed too often, and when publishers must be slowed
  3. L6: The delivery contract: at most once, at least once or a claimed exactly once, the order kept, and durability, held jointly by the broker, the publishers (confirms, retransmission) and the consumers (acknowledging after the work, idempotence)
  4. L7: The decoupled work: requests turned into units of work that independent workers can take when they are ready, load shared and bursts buffered; the applications' purposes

way in: Acknowledgements, rejections and deletes from workers

  1. L1: Acknowledgement frames from workers, flowing the other way from deliveries
  2. L2: The delivery tag, which names one delivery on one channel
  3. L3: Settlement: an ack deletes, a reject or nack with requeue set returns the message to the queue, without it discards or dead-letters; in SQS, DeleteMessage

way in: Clocks and timeouts (leases, time-to-live, retention, consumer timeouts)

  1. L1: The broker's clock, from which each lease and lifetime is counted
  2. L2: Each message's timestamps: enqueue time, receipt, its own time-to-live
  3. L3: Expiry: a lease runs out and the message is visible again; a time-to-live or retention runs out and it is dropped or dead-lettered

way in: Configuration and policy from operators

  1. L1: An administrator at a command line, management interface or HTTP API
  2. L2: Policies: dead-letter exchange, delivery limit, length limit, timeouts
  3. L3: Applied to every queue whose name matches the policy pattern

way in: Connection state and heartbeats of consumers and publishers

  1. L1: The TCP connection, which can die silently or be cut by firewalls
  2. L2: Heartbeat frames on the AMQP connection
  3. L3: The verdict that a consumer is gone, which cannot tell a crashed consumer from a slow one

way in: Messages from producers (publishes)

  1. L1: Producers' messages as bytes on the network
  2. L2: The publisher's connection and channel: AMQP frames over TCP, or an HTTP request to a cloud queue
  3. L3: The exchange matches the routing key against the bindings and passes the message to the bound queues; with the mandatory flag, an unroutable message comes back

way in: Replication traffic from the other broker nodes

  1. L1: The links between broker nodes, which can be partitioned
  2. L2: The replication protocol: Raft for quorum queues (mirroring in older RabbitMQ)
  3. L3: A majority, (N/2)+1, agrees on the queue's state and contents

way in: The broker's own files, read back at a restart

  1. L1: What the disks hold after a restart or power loss: what was flushed, not always what was acknowledged
  2. L2: Segment and block files
  3. L3: Checksums and replay rebuild the queue (and may silently drop part of it)

way in: The node's own memory and disk (resource alarms)

  1. L1: The node's RAM and disk
  2. L2: The node's memory footprint read against the watermark
  3. L3: The alarm, raised on this node and then on all cluster nodes
  4. L4: Near maximum load, waiting messages are written out to disk to free memory, and latency worsens

way out: Confirms and back-pressure to publishers

  1. L1: Frames back to the publisher
  2. L3: Flow control: publishing connections slowed or blocked
  3. L6: A confirm once the broker has taken responsibility (stored, replicated)

way out: Dead-lettering and backout

  1. L3: Republished through the dead-letter exchange's ordinary routing
  2. L4: It leaves the source queue and waits in the dead-letter queue for people to examine or redrive
  3. L5: A message is rejected without requeue, expires, overflows a length limit, or passes the delivery limit

way out: Deliveries to workers

  1. L1: Bytes to the worker, whose registered routine is called
  2. L2: Pushed on the consumer's channel, or returned to a polling receive (long polling waits rather than erring when the in-flight limit is reached)
  3. L5: A worker with free credit is chosen; the message becomes unacknowledged and hidden from the others

way out: Messages dropped (expired, overflowed, over the limit with no dead-letter target)

  1. L1: Gone from storage, with no copy kept
  2. L4: Removed from the queue

way out: Metrics and states shown to operators and autoscalers

  1. L1: To screens and to the scaling policy that sizes the worker fleet
  2. L6: Queue length, age of the oldest message, flow states

Sources (44) published science

Message queue (Wikipedia, via Wikimedia Enterprise snapshot 2026-12-01)
Amazon SQS Developer Guide: Amazon SQS visibility timeout (read 2026-12-05) (behind its links)
RabbitMQ 4.4 documentation: Quorum Queues (read 2026-12-05; sections on quorum, dead lettering, consumer timeout, poison message handling) (behind its links)
RabbitMQ 4.4 documentation: Memory Threshold and Limit (read 2026-12-05; sections on the threshold) (behind its links)
RabbitMQ 4.4 documentation: Consumer Acknowledgements and Publisher Confirms (read 2026-12-05; sections on acknowledgement modes, requeueing, prefetch, automatic requeueing, publisher confirms) (behind its links)
Amazon EC2 Auto Scaling User Guide: Scaling policy based on Amazon SQS (read 2026-12-05) (behind its links)
Bronson NG, Aghayev A, Charapko A, Zhu T (2021). Metastable failures in distributed systems. HotOS 2021. doi:10.1145/3458336.3465286 [read in sections: abstract, introduction, case studies (request retries), trigger vs root cause, industry practices] (behind its links)
RabbitMQ 4.4 documentation: Reliability Guide (read 2026-12-05) (behind its links)
Kingsbury K. Jepsen: RabbitMQ (Call me maybe), 2014-06-06: fault-injection analysis with network partitions (aphyr.com); read: lock-service and queue sections, results, recommendations (behind its links)
Amazon SQS Developer Guide: Using dead-letter queues in Amazon SQS (read 2026-12-05) (behind its links)
Advanced Message Queuing Protocol (Wikipedia, via Wikimedia Enterprise snapshot 2026-12-01; read: abstract, History, link protocol, message format) (behind its links)
Amazon SQS Developer Guide: Amazon SQS message quotas (read 2026-12-05) (behind its links)
Amazon SQS Developer Guide: Exactly-once processing in Amazon SQS (read 2026-12-05) (behind its links)
Amazon Simple Queue Service (Wikipedia, via Wikimedia Enterprise snapshot 2026-12-01) (behind its links)
RabbitMQ 4.4 documentation: Flow Control (read 2026-12-05) (behind its links)
Dobbelaere P, Sheykh Esmaili K. Kafka versus RabbitMQ: a comparative study of two industry reference publish/subscribe implementations. DEBS 2017 (arXiv:1709.00333); read: sections 2-5 and 8 (behind its links)
John V, Liu X. A Survey of Distributed Message Broker Queues. arXiv:1704.00411 (preprint, University of Waterloo), 2017; read: sections 1-7 and appendices A-B (behind its links)
Wang G, Chen L, Dikshit A, et al. Consistency and Completeness: Rethinking Distributed Stream Processing in Apache Kafka. SIGMOD 2021. doi:10.1145/3448016.3457556; read: sections 3-5 (behind its links)
Kingsbury K. Jepsen: NATS 2.12.1, 2025-12-08: fault-injection analysis of NATS JetStream (jepsen.io); read: summary, background, sections 3.2 and 3.4, discussion (behind its links)
Gray J. Queues Are Databases. Microsoft Research MSR-TR-95-56, HPTS 95 position paper, December 1995 (arXiv:cs/0701158, 2007); read in full (the portal said SHORT TEXT: the file holds all 12 pages) (behind its links)
Habibi F, Lorido-Botran T, Showail AJ, Sturman D, Nawab F. MSF-Model: Queuing-Based Analysis and Prediction of Metastable Failures in Replicated Storage Systems. SRDS 2024. doi:10.1109/srds64841.2024.00013 (arXiv:2309.16181); read: sections I-III (behind its links)
Apache Kafka Improvement Proposal KIP-932: Queues for Kafka (Apache wiki, read 2026-12-05; status Accepted; read: motivation, share groups, delivery count, ordering) (behind its links)
Message-oriented middleware (Wikipedia, via Wikimedia Enterprise snapshot 2026-12-01; read: abstract) (behind its links)
Amazon SQS Developer Guide: Amazon SQS at-least-once delivery (read 2026-12-05) (behind its links)
IBM MQ 9.4 documentation: Handling poison messages in IBM MQ classes for JMS (read 2026-12-05) (behind its links)
IBM MQ (Wikipedia, via Wikimedia Enterprise snapshot 2026-12-01; read: abstract, Features, History) (behind its links)
Helland P. Idempotence Is Not a Medical Condition: an essential property for reliable systems. ACM Queue 10(4), 2012. doi:10.1145/2181796.2187821; read: from the opening through Plumbing Can Mask Ambiguities (ACKs, guaranteed delivery, TCP, idempotence) (behind its links)
Humphries, Natu, Chaugule, Weisse, Rhoden, Don, Rizzo, Rombakh, Turner, Kozyrakis 2021, ghOSt: fast and flexible user-space delegation of Linux scheduling, SOSP, doi:10.1145/3477132.3483542 (sections read: abstract, sections 1-2) (behind its links)
RabbitMQ 4.4 documentation: Dead Letter Exchanges (read 2026-12-05) (behind its links)
Bernstein PA, Hsu M, Mann B. Implementing recoverable requests using queues. Proc. ACM SIGMOD 1990. doi:10.1145/93597.98721 (OpenAlex stored full text; OCR of the scan); read: abstract, sections 1-6 and the conclusion (behind its links)
Kreps, Narkhede & Rao 2011, Kafka: a Distributed Messaging System for Log Processing, NetDB'11 (read in full from an open copy of the PDF) (behind its links)
RabbitMQ (Wikipedia, via Wikimedia Enterprise snapshot 2026-12-01; read: abstract, History) (behind its links)
Helland P. Life Beyond Distributed Transactions: an apostate's opinion. ACM Queue 14(5), 2016 (first CIDR 2007). doi:10.1145/3012426.3025012; read: sections on at-least-once messaging, retries and idempotence (behind its links)
Fu X, Li X, Xu P, Zeng J (2020) Inhibiting the whole number bias in a fraction comparison task: an event-related potential study. Psychol Res Behav Manag 13:245-255. doi:10.2147/PRBM.S240263 (PMC7064278, CC BY-NC) (behind its links)
PostgreSQL documentation (current): SELECT, The Locking Clause (read 2026-12-05; that section) (behind its links)
OASIS Advanced Message Queuing Protocol (AMQP) Version 1.0, Part 2: Transport, 2012 (read: 2.6 Links, 2.6.7 Flow Control) (behind its links)
Saltzer J.H., Reed D.P., Clark D.D. (1984) End-to-end arguments in system design. ACM Transactions on Computer Systems 2(4):277-288. doi:10.1145/357401.357402 (behind its links)
Gray C, Cheriton DR. Leases: an efficient fault-tolerant mechanism for distributed file cache consistency. SOSP 1989. doi:10.1145/74851.74870; read: sections 1-2, 5 and the conclusion (behind its links)
Burrows M. The Chubby lock service for loosely-coupled distributed systems. OSDI 2006 (Google research open copy); read: section 2.4 Locks and sequencers (behind its links)
Nichols K, Jacobson V. Controlling Queue Delay. ACM Queue 10(5) / CACM 55(7), 2012. doi:10.1145/2208917.2209336; read: Understanding Queues and the CoDel sections (behind its links)
Brinch Hansen P. The nucleus of a multiprogramming system. CACM 13(4), 1970. doi:10.1145/362258.362278 (portal: abstract only; read in the author's open copy at brinch-hansen.net: abstract, introduction, process communication) (behind its links)
RabbitMQ 3.13 documentation: Classic Queue Mirroring (read 2026-12-05: the opening notice) (behind its links)
Little's law (Wikipedia, via Wikimedia Enterprise snapshot; read: abstract) (behind its links)
M/M/1 queue (Wikipedia, via Wikimedia Enterprise snapshot; read: model definition and stationary analysis) (behind its links)