← all systems · see it in The System
Message queue and work queue
| boundary | Inside: 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 level | Rung 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. |
| scale | technological |
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 at | about 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, history | 8 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 defaults | about 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 load | below 10 ms |
| Kafka latency read from cache, 50th / 99.9th percentile | 1 / 15 (no replication); 1 / 30 (replication) ms |
| Kafka latency when reads go to disk | up 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 case | 560 (normal load 280) queries per second |
| load below which the worked system self-heals | 150 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 1995 | 30 years |
| share of studied metastable incidents involving retry storms | over 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.
- C-4573 Which message broker (software that passes messages between programs), Kafka or RabbitMQ, is faster? Tests run in different settings give different answers.
booked: The map keeps both readings side by side and rules on neither.
the other reading: Kafka outperforms the others in every test case (src:fu-2020); Kafka has higher throughput while AMQP has lower latency (src:john-liu-2017); Kafka looks better only in an ideal setting; in a realistic one RabbitMQ outperforms it on latency (src:dobbelaere-2017) - C-4588 Can a messaging system really deliver each message exactly once, or is that always 'at least once' with duplicates filtered out?
booked: The map keeps both readings side by side and rules on neither.
the other reading: Exactly-once is a delivery guarantee some systems give: IBM MQ "uses once and once only delivery" and AMQP 1.0 settlement can enforce exactly-once (src:wp:ibm-mq; src:wp:amqp); Exactly-once is possible at a price, by an expensive end-to-end two-phase commit (src:dobbelaere-2017); recoverable queues give exactly-once request processing (src:bernstein-1990); It is a naming question: Pulsar calls it effectively-once (src:fu-2020); End to end (Saltzer, Reed and Clark 1984): duplicate suppression and the acknowledgement that matters can only be done by the application; a two-phase commit is one way to get that end-to-end acknowledgement (src:saltzer-1984) - C-4590 Is a stored message log such as Kafka a kind of message queue, or a different thing that sits beside queues?
booked: The map keeps both readings side by side and rules on neither.
the other reading: A log is a kind of message queue: Fu et al. call Kafka, Pulsar and RabbitMQ alike "message queuing systems"; John and Liu survey Kafka as a "distributed message broker queue" (src:fu-2020; src:john-liu-2017); Kafka "departed from the classic principles of messaging systems" (src:dobbelaere-2017); NATS calls itself "a distributed streaming system" (src:kingsbury-2025-nats); Queue and log are two ways of consuming that can sit over one store, and products are converging: Kafka's accepted KIP-932 adds share groups with per-message acknowledgement, delivery counts and a 30 s acquisition lock to Kafka topics (src:kip-932). Release date not stated on the page read. - C-4598 When did message queues (holding messages for programs to pick up later) begin: in IBM's 1960s systems, in a 1970 operating system, or in 1980s and 1990s products?
booked: The map keeps both readings side by side and rules on neither.
the other reading: the early 1980s message-queue real-time operating systems (VRTX, pSOS+); MQSeries in December 1993 as the first message-oriented middleware product; the ordinary operating-system queue between processes (System V), date not read; Brinch Hansen's RC 4000 multiprogramming nucleus (paper 1970): message buffering in the nucleus as 'the basic means of process communication', with a message queue for each process (src:brinch-hansen-1970) - C-4608 Are message queues best built inside a database, or as separate software that links systems a database cannot reach?
booked: The map keeps both readings side by side and rules on neither.
the other reading: Gray 1995: a queue manager is best built atop a database, and databases will evolve to provide queues; Gray's own reconsideration: middleware thrives by connecting heterogeneous systems a database cannot reach; PostgreSQL: skipping locked rows gives an inconsistent view and suits only queue-like tables
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.
- causal ceiling (structural)
No queue can know for certain whether its consumer did the work: 'Acknowledge before processing the message, and a crash can cause data loss. Acknowledge after processing, and a crash can cause duplicate delivery.' Kingsbury ties this to FLP and the Two Generals; the broker 'can't tell the differenc - holding / entrainment (structural)
The whole sets the number and the death of its workers: server pools grow and shrink with traffic, servers are created when the queue reaches a size, a server that fails is replaced, and too many failures in a window and the queue is declared broken; in the cloud, fleets are scaled on the backlog pe - lightning (structural)
A stored difference released at once: when connectivity returns after an outage, 'all the packets lost during the outage are retransmitted, including requests and retries sent during the 10 s', and the surge tips the system into the metastable state; the trigger is gone but the system is not the sam - nested ladder (structural)
Two ladders of promises, each rung implying those below: ordering goes none, then per partition or group, then global, each more expensive; delivery goes at most once (no duplicates), at least once (no loss), exactly once (both). Global order implies order within every partition. The ordering rungs - runaway from an unstable balance (structural)
Metastable failure: below a hidden capacity a trigger passes; above it, a trigger tips the system into a state its own retries sustain (load doubled to 560 QPS by retries; recovery only under 150 QPS). Systems are run in the vulnerable state on purpose because it is more efficient. The balance point - same role, different builds (structural)
One job, holding a message for one worker so no other takes it meanwhile, done by unrelated builds: a visibility timeout that hides it for a set time (SQS), an unacknowledged delivery tied to a channel and freed when the channel closes (RabbitMQ), a row lock that other dequeues read past or skip (a - same shape, opposite sign (structural)
One mechanism run in both directions: an acknowledgement is receipt plus transfer of ownership, sent by the consumer to the broker; publisher confirms are the same act from broker to publisher ('mimics the consumer acknowledgments mechanism'). And one act, the acknowledgement, placed before or after - The carry (structural)
All three faces. Overflow passed on: a queue over its length limit drops messages, and a dead-letter exchange passes them to the next queue; a message past the delivery limit is passed on the same way. The wait: queues have their best latency when nearly empty, and when clients saturate a server poo - The Payment to Entropy (structural)
Every hand-off of a message pays: acknowledged messages lost (about 35% under partitions in 2014; 131,418 of 930,005 to simulated power failure in 2025), duplicates that must be absorbed ('a tax on the throughput of the system'), and durability bought with throughput (transactions that 'drastically - trade one property for another (structural)
Safety bought with throughput and the kinds spread along the trade: automatic acknowledgement trades safety for throughput; higher prefetch more throughput and more consumer memory; batching throughput against latency; Kafka performance over reliability against AMQP for financial messages. Systems a - Umwelt: each system carves its own slice of one shared medium (structural)
Each party carves its own slice of one delivery: the broker sees only TCP state, heartbeats and acknowledgements and cannot tell a crashed worker from a slow one; a transport ACK tells the sender only that 'the message has been received at the next machine'; the redelivered flag says only that a con - who opens the door (structural)
Nothing enters a queue unless someone opened the door from the inside first: applications create the bindings that decide which messages an exchange hands to each queue, and the receiving application registers a routine that listens on the queue; a message with no bound queue is returned (mandatory - borrowed-then-held (partial)
Duplicate suppression first left to the application (idempotent consumers; "In practice, the low-level management of this knowledge rarely occurs") and later held by the broker inside a window or scope (SQS FIFO's 5-minute deduplication; Kafka's idempotent producer). Both phases are in the sources; - conservation law plus closure (partial)
The at-least-once promise (no loss) leaves the duplicate slot open; it predicts correct results only when closed by a second rule at the consumer, idempotence or deduplication ("Design your applications to be idempotent"). The closing rule is the end-to-end argument's: duplicate suppression 'must be - coordination-before-mapping (partial)
Competing workers share out the work with no model of each other or of the producers: each takes the next message; producers keep no state about consumers. The broker does hold the queue state, which is a record of the work, not a map of the world. - partner-becomes-part (partial)
Two systems that worked side by side, the queue manager and the database, merged in some products: 'when a queuing mechanisms was added to Tandem's database servers, several applications became simpler and faster'; SQL Service Broker holds messaging and dialog state in the database (Helland). Gray p - same toolkit, independent builds (partial)
Separately built brokers converge on the same parts: acknowledgements, redelivery counters with a limit, dead-letter queues, majority replication on Raft (RabbitMQ quorum queues; NATS JetStream). Shared standards (AMQP, JMS) and shared literature mean the builds are not fully independent. A further - symmetry breaking (name the cut) (partial)
Replicas of a quorum queue are alike until one is elected leader; queue state changes then happen on the leader, and during a re-election delivery pauses. The cut is named (the election); whether the broken direction sets what is built after is only partly shown. - templating (partial)
AMQP fixes the bytes on the wire so any compliant tool interoperates with any other, as SMTP and HTTP do; JMS let Java developers switch providers "in a fashion similar to ... SQL databases", though the encyclopedia adds that this "wasn't always as practical as it could be". - the whole sets the local reference (partial)
Order holds locally and not globally: within a partition or message group messages arrive in order, across partitions there is no guarantee; one flow spread over several channels 'will have no ordering relation anymore'. The producer's choice of key sets which local frame a message reads true in. - barrier-gates-complexity (surface)
The durable queue between client and server enables workflow, disconnected operation and replication, and also forbids a conversation from being one transaction (the tri-ACID model). The without-the-queue case is direct processing, shown by Gray, but what the boundary buys is decoupling more than co - namespace completeness (the map predicts its gaps) (surface)
Three primitives (no loss, no duplication, no disorder) generate the menu of delivery and ordering guarantees; the grid names an exactly-once cell that the field argues over. A menu more than a map that predicts members. - smooth to sharp in finite time (surface)
Latency rises steeply as queues fill (about a hundredfold with five times the clients; "sharp increased latency" as the exchange saturates), but no source shows it becoming singular: the dark twin, booked as surface. Queueing theory says why it stays surface: in the single-server model the queue is
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.
- Scheduler (computing) via Computer hardware · Message queue and work queue gain
- Human (Homo sapiens) via The world through the senses (sensory environment) · Message queue and work queue gain
- Computer memory via Computer memory · Message queue and work queue gain
- Internet protocol suite (TCP/IP): the layered datagram protocols every host and router runs, the RFC record that specifies them, and the community that keeps them via Electromagnetic field · Message queue and work queue gain
- Operating system via Computer hardware · Message queue and work queue gain
- Database via Computer hardware · Message queue and work queue gain
- Computer network via Electromagnetic field · Message queue and work queue mixed
- Cloud computing via Computer hardware · Message queue and work queue gain
- Byzantine fault via Computer network · Message queue and work queue mixed
- Event streaming: the distributed log via Written record (durable external marks: texts, archives, canon) · Message queue and work queue mixed
Partners and parts published science
Built from / builds (6)
- Message broker (queue manager)
- Worker pool (competing consumers)
- Producers (publishing applications)
- Dead-letter queue (backout queue, error queue)
- Messaging protocol (AMQP, STOMP, MQTT; HTTP for cloud queues)
- Distributed logs, message queues and log aggregators competing to carry organizations' data
Sits inside / holds (3)
expressed by (22)
- Scaffolding/Enablement (Meta-Tooling)
- Templating / Standardization
- Interoperability/Transduction (Bridging)
- Encapsulation & Modularity (Abstraction)
- Distributed Autonomy/Decentralized Execution (Subsidiarity)
- Internal Coordination/Regulation
- Sensing/Scanning
- Trail-Marking / Externalized Memory (Stigmergy)
- Surprise / Change-Point Detection
- Quick Harm Avoidance
- Reactive Response
- Physical/Virtual Barrier
- Self-Monitoring
- Delay/Redirection Tactics
- Validation of Effectiveness
- Enclave/Segregation
- Resilience & Repair
- Redundancy & Diversity
- Triage & Prioritized Allocation
- Quality Control & Error Correction
- Bridging Supply Gaps (Store & Dormancy)
- Scheduled Build-and-Dismantle (On-Demand Structure)
floor filled by (13)
- Human (Homo sapiens)
- Computer memory
- Internet protocol suite (TCP/IP): the layered datagram protocols every host and router runs, the RFC record that specifies them, and the community that keeps them
- Operating system
- Database
- Computer network
- Cloud computing
- Message broker (queue manager)
- Worker pool (competing consumers)
- Producers (publishing applications)
- Dead-letter queue (backout queue, error queue)
- Messaging protocol (AMQP, STOMP, MQTT; HTTP for cloud queues)
- Transaction processing monitor
Kinds (9)
- IBM MQ (MQSeries)
- RabbitMQ
- Amazon Simple Queue Service
- Queue kept in a database table
- Operating-system message queue (System V, POSIX)
- Event queue of a graphical program
- Actor mailbox (Erlang processes)
- Apache ActiveMQ (JMS)
- IBM WebSphere MQ
Notes published science
- 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).
- Retries, the feature meant to hide brief faults, can keep a system down after the fault is gone: in one worked case, a web application and its database, a 10-second network outage left the database stuck at 560 queries a second, twice its normal load of 280 because every query was retried once, doing no useful work until the load was cut below 150 (src:bronson-2021).
- Outside testers who cut networks and pulled the plug found queues losing messages they had already said were safe: a RabbitMQ cluster lost about 35% of them under network splits in 2014 (in a queue design RabbitMQ has since removed), and in 2025 NATS was found, by default, to write to disk only every two minutes while confirming at once, losing 131,418 of 930,005 messages to simulated power failures (src:kingsbury-2014-rabbitmq; src:rabbitmq-mirroring; src:kingsbury-2025-nats).
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)
- 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
- 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
- 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
- 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
- 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
- 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
- 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)
- 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)
- 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
- 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)
- 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
- L1: Acknowledgement frames from workers, flowing the other way from deliveries
- L2: The delivery tag, which names one delivery on one channel
- 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)
- L1: The broker's clock, from which each lease and lifetime is counted
- L2: Each message's timestamps: enqueue time, receipt, its own time-to-live
- 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
- L1: An administrator at a command line, management interface or HTTP API
- L2: Policies: dead-letter exchange, delivery limit, length limit, timeouts
- L3: Applied to every queue whose name matches the policy pattern
way in: Connection state and heartbeats of consumers and publishers
- L1: The TCP connection, which can die silently or be cut by firewalls
- L2: Heartbeat frames on the AMQP connection
- L3: The verdict that a consumer is gone, which cannot tell a crashed consumer from a slow one
way in: Messages from producers (publishes)
- L1: Producers' messages as bytes on the network
- L2: The publisher's connection and channel: AMQP frames over TCP, or an HTTP request to a cloud queue
- 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
- L1: The links between broker nodes, which can be partitioned
- L2: The replication protocol: Raft for quorum queues (mirroring in older RabbitMQ)
- 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
- L1: What the disks hold after a restart or power loss: what was flushed, not always what was acknowledged
- L2: Segment and block files
- 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)
- L1: The node's RAM and disk
- L2: The node's memory footprint read against the watermark
- L3: The alarm, raised on this node and then on all cluster nodes
- 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
- L1: Frames back to the publisher
- L3: Flow control: publishing connections slowed or blocked
- L6: A confirm once the broker has taken responsibility (stored, replicated)
way out: Dead-lettering and backout
- L3: Republished through the dead-letter exchange's ordinary routing
- L4: It leaves the source queue and waits in the dead-letter queue for people to examine or redrive
- L5: A message is rejected without requeue, expires, overflows a length limit, or passes the delivery limit
way out: Deliveries to workers
- L1: Bytes to the worker, whose registered routine is called
- 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)
- 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)
- L1: Gone from storage, with no copy kept
- L4: Removed from the queue
way out: Metrics and states shown to operators and autoscalers
- L1: To screens and to the scaling policy that sizes the worker fleet
- L6: Queue length, age of the oldest message, flow states