Queues
Size, watch, and operate the queues a Nova cluster delivers, and know what each failure does to them.
Every novad node delivers queues. The nodes divide the cluster's queue ranges among themselves, and while a worker of a queue is connected to a node, that node runs a seat for each range it was given. A seat is in-memory state: it reads the range, hands messages to workers, and saves how far delivery has got. A queue nobody consumes costs a node nothing.
curl -s localhost:9191/metrics | grep '^nova_queue' | grep -v '_total\|_bucket\|_sum\|_count'nova_queue_backlog_age_seconds{address="apps/emails"} 141.899
nova_queue_claim_age_seconds{address="apps/emails"} 1.621
nova_queue_queues_attended 1
nova_queue_ranges_dealt 1
nova_queue_ranges_isolated 0
nova_queue_ranges_leftover 0
nova_queue_read_ahead_target_bytes 65536
nova_queue_seats{state="dealing"} 0
nova_queue_seats{state="idle"} 1
nova_queue_seats{state="waiting"} 0
nova_queue_window_held_bytes{part="entries"} 3920
nova_queue_window_held_bytes{part="read_ahead"} 0
nova_queue_window_held_bytes{part="sending"} 0
nova_queue_window_share_bytes 4.69762048e+08The OpenTelemetry scope labels and some series are left out.
Before you run queues
| Requirement | Why |
|---|---|
Workers that use work sessions can reach every node's --advertise address | A work session is a gRPC stream to the node delivering a range. One-shot claims need only the Gateway or one node. |
| The dispatch keyspace exists in the metadata store | It holds every queue's settings and delivery state. It cannot be rebuilt, so back it up with the streams keyspace. |
With --auth jwt, the nodes can mint tokens | A node mints a token scoped to one queue to read ranges other nodes lead and to append retries and dead letters |
Queue memory on a node
A seat keeps an entry for each message it has read and not settled, ready or claimed: the message's position and the fields it is delivered by, never its body. It holds a message's record only from just before delivery until the record reaches the worker. All of it counts against the node's window budget, 512 MiB by default, as heap:
| Held | Counted as |
|---|---|
| An entry, ready or claimed | 512 bytes plus its routing key and message ID: about 600 bytes with a UUID ID, whatever the body size |
| A record held ahead of delivery (the read-ahead) or on its way to a worker | Its body and headers, plus 48 bytes, plus 48 bytes per header |
| A fetch out | The records it asks for, up to about 1 MiB, until it returns |
Sharing it
Queues consumed on the same node share its window budget. Each range with a worker is owed an equal share. A busy range uses more while the node has room. When another range needs room, ranges above their share give back what they can and take no new claims until their own are settled. A queue whose workers hold claims without acknowledging them therefore cannot starve the other queues on its node.
What a queue costs
| The queue on this node | Memory | Goroutines and reads |
|---|---|---|
| No worker reaches it here | Nothing | None |
| A work session or one-shot claim of it is open: the queue is attended | Its address, and about 160 bytes per range the node delivers | One map read when it becomes attended |
| Each range with a worker: an open seat | About 22 KiB, plus its entries | 3 goroutines, about 30 µs of CPU a second |
| Its workers keep up | Entries for messages not yet settled, and records not yet written to workers | Records come with the range's read, once |
| Its workers fall behind | Entries up to its share, up to 1 MiB of read-ahead, and one fetch | Records without room in the read-ahead are read again just before delivery, in reads of up to 256 records or 1 MiB |
| Its last worker left | Entries, until the seat closes | The seat closes after 60 s, unless claims, writes, delays, or remembered idempotent IDs hold it open |
A record fetch is served by the range's leader, from its recent-record cache (128 MiB by default, about 2.5 s of a 50 MiB/s ingest) and then from object storage at about two GETs a read. A range further behind than that reads each record from object storage twice: once to make the entry and once to deliver it.
Size the window budget
Size the budget for the ranges consumed on a node at the same time that are behind. A range that keeps up holds little.
- A range needs room for its claims out, its read-ahead, and one fetch. With 1,024 claims out, that is about 600 KiB of entries, 1 MiB of read-ahead, and a 1 MiB fetch.
- Room beyond that holds more of the backlog as entries, so the round robin across keys reaches further into it and a noisy key shows.
- To let N ranges each hold a full 8 MiB window at once, set the budget to N × 8 MiB × 8 ÷ 7, plus the 64 MiB fetch pool. For 100 ranges that is about 978 MiB, so 1 GiB. This holds for budgets of 512 MiB or more.
--memory-ceiling and the node's memory saturation do not count queue memory. Leave room for it under the container's memory limit: the budget, plus about 22 KiB per open seat (176 MiB at 8,192 seats) and 160 bytes per range delivered (160 MiB at 1,048,576 ranges).
No novad flag sets these bounds
The window budget, the seat and session caps, and the dispatch budget are fields of the daemon's Dispatch configuration, with no novad flag or Kubernetes field. Run with the defaults, or build a host that sets them. Node bounds lists them.
Other costs
| Resource | Estimate |
|---|---|
| Metadata writes, memory claims | About 4 a second per busy range (the progress save), plus one per failed attempt and one per delayed message |
| Metadata writes, persisted claims | The above, plus two claim rows per delivered message in batches of up to 1,024, and one range delete per progress save |
Metadata, durable dedup | One row per idempotent send; two point reads for each idempotent send and each idempotent message a seat reads; one range delete per queue for each 5 minutes of idempotent sends |
| Object storage writes | Each retry, delay, and replay appends the message again: a message retried five times is stored six times until retention removes it |
| Object storage reads | A range behind its read-ahead reads each record twice |
What to watch
Alert on ages, each labelled by address:
| Metric | Measures | A climbing value means |
|---|---|---|
nova_queue_backlog_age_seconds | The oldest unsettled message, from its first send | Workers do not keep up |
nova_queue_claim_age_seconds | The oldest claim a worker still holds | Near the claim TTL, workers die holding messages; far past it, a worker keeps extending |
nova_queue_due_lag_seconds | How long the earliest due retry or delayed message has waited to be sent on | Retries and delays arrive late |
The shipped alert rules do not cover queues, so write your own on these ages, with thresholds from each queue's claim TTL and how late its messages may be. A node labels its 32 furthest-behind queues and folds the rest into address="other". A queue with nothing waiting has no series, and a queue nobody consumes has no seat, so it reports no age at all; read its age on the admin UI instead.
The Operations dashboard charts every queue metric:
| Panel | What it tells you |
|---|---|
| Queue window held by part | Where the node's queue memory is. entries growing toward the budget while read_ahead stays small is claims nobody settles. |
| Queue read-ahead target | What seats aim to hold ahead of delivery: half a second of what each delivers. read_ahead well below it while workers wait means seats are behind and read records twice. |
| Queue window share | What each active seat is owed; it falls as more ranges are consumed on the node |
| Queue window given back | A steady rate means more ranges are consumed on the node than the budget holds |
| Queue deals by record source | Mostly kept means seats keep up; mostly fetched means they read each record twice |
| Queue records per fetch read | Near 256 means fetches are batched; near 1 means records are fetched one at a time |
| Queue record fetch failures | A range whose leader or object storage does not answer |
| Queue ranges waiting for a seat | The node has its most seats open |
Logs lists the queue warnings and what to do for each.
Purge a queue
A purge removes every unsettled message sent before it, including messages waiting for a retry or a delay. The queue, its settings, and its dead letters stay. Run it with nova queue purge, POST …/purge, or Purge; it needs the trim grant.
nova queue purge nova://apps/emailspurged nova://apps/emails: 7 messages removed- Claims a worker holds are taken back. A work session receives
revokedwithWORK_REFUSAL_CLAIM_GONE, and settling one is refused withclaim_gone. - The receiving node forwards each range's purge to the node delivering it and purges any range no node delivers. Messages sent during the purge are kept or removed depending on whether they were stored before their range was purged.
- The count is exact, and lands in
nova_queue_messages_purged_total. A purge never counts as expiry. - If a range's node cannot be reached, the purge empties every range it can, then fails and reports what it removed. Run it again and add the counts.
- With
--auth jwt, when a range's messages are stored on a different node from the one that delivers them, the purge fails withPermissionDenied, even withtrim. Purge with a token that holdsnova:admin; see Purge a queue.
When things fail
A worker crashes
Each claim the worker held stays out until its deadline, then fails an attempt and is retried under the queue's policy. A crashed worker delays its messages by up to the claim TTL.
A node drains or restarts
A draining node leaves dispatch, and each seat saves its progress as it ends. With memory claims, sessions receive revoked and the next node delivers those messages again. With persisted claims, nothing is revoked: workers settle the same claims at the next node. Within one 5-second pass, the node that gains a range opens seats for the sessions connected to it, and sessions elsewhere receive a new dispatchers frame.
The old node can keep delivering until its seat learns of the new one, at its next save, its next claim row, or its next 5-second pass; in rolling-restart tests this took 100 to 250 ms. The new seat can deliver again what the old one delivered meanwhile, so on a key-ordered queue two messages of one key can be out at once.
A node dies
The node's membership ends when its metadata session expires (--oxia-session-timeout: 10 s with external oxia, 15 s embedded). Within 5 seconds, the nodes that gain its ranges open seats for the connected workers.
| Claims mode | Delivered again |
|---|---|
memory | Messages that were with workers, and acknowledgements since the last save: at most 250 ms of them, or 1,024 |
persisted | Nothing; standing claims wait for their ack or deadline |
Messages the dead node stored but had not indexed become readable once its ledger is recovered, which a seat reading the range starts itself; recovery takes about 2 seconds. Sends to ranges it did not lead continue throughout. A node cut off but still running keeps delivering for at most one 5-second pass, and its successor can deliver that again.
The metadata store is unreachable
| Part | Behavior |
|---|---|
| Sends | Continue while the ranges have leaders |
Delivery, memory claims | Continues from memory; acks wait in memory and saves retry |
Delivery, persisted claims | Stops; no claim is delivered without its row |
Delivery, durable dedup | A range stops at the first idempotent message it reads |
Idempotent sends, durable dedup | Fail with UNAVAILABLE over HTTP and gRPC |
| Failed attempts | Retried in place at once, without backoff |
| Delays | Held in memory; nothing is delivered early |
| Create, update, delete, list, purge | Fail with UNAVAILABLE (503) |
An outage longer than the session timeout ends every node's membership; with memory claims, expect a node death's redeliveries on every range.
Object storage is slow
Retries, delays, and dead letters are appends, so they wait with every other append and the due lag rises. Seats keep delivering what they hold, and retry their reads after a pause that grows from 100 ms to 2 s.
Retention passes a backlog
message_ttl_ms removes stored messages by age, delivered or not. A seat then skips to the first message left, logs the retention trimmed warning with the count, and adds it to nova_queue_messages_expired_total{cause="trimmed"}.
Limits to know
| Limitation | What to do |
|---|---|
| A node short of window budget gives a queue that needs room only part of it at once; the rest comes as other queues' claims are settled | Size the window budget for the ranges consumed at once |
| Refused work sessions and credit grants are logged but not counted | Alert on the log lines |
| A node keeps a queue's seats for 60 s after its last worker leaves | Expect queue memory to fall a minute after workers stop |
| You cannot purge dead letters or replay chosen ones | Let dead_letter_ttl_ms remove them |
| A replay cut short blocks the next one until 2 minutes after it began | Retry after that |
With --auth jwt, a replay whose dead letters are stored on a different node from the one delivering the queue sends them, then fails with PermissionDenied; the sent letters stay, so a second replay sends them again | Replay with a token that holds nova:admin; see nova queue replay-dead-letters |
| A replaced node can overwrite its successor's persisted claim rows until every node runs a build from 16 November 2026 or later | Finish rolling upgrades promptly; see Queues with persisted claims |