Queues

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.

A node's queue gauges, one queue with a claim out
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+08

The OpenTelemetry scope labels and some series are left out.

Before you run queues

RequirementWhy
Workers that use work sessions can reach every node's --advertise addressA 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 storeIt 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 tokensA 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:

HeldCounted as
An entry, ready or claimed512 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 workerIts body and headers, plus 48 bytes, plus 48 bytes per header
A fetch outThe 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 nodeMemoryGoroutines and reads
No worker reaches it hereNothingNone
A work session or one-shot claim of it is open: the queue is attendedIts address, and about 160 bytes per range the node deliversOne map read when it becomes attended
Each range with a worker: an open seatAbout 22 KiB, plus its entries3 goroutines, about 30 µs of CPU a second
Its workers keep upEntries for messages not yet settled, and records not yet written to workersRecords come with the range's read, once
Its workers fall behindEntries up to its share, up to 1 MiB of read-ahead, and one fetchRecords 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 leftEntries, until the seat closesThe 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

ResourceEstimate
Metadata writes, memory claimsAbout 4 a second per busy range (the progress save), plus one per failed attempt and one per delayed message
Metadata writes, persisted claimsThe above, plus two claim rows per delivered message in batches of up to 1,024, and one range delete per progress save
Metadata, durable dedupOne 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 writesEach retry, delay, and replay appends the message again: a message retried five times is stored six times until retention removes it
Object storage readsA range behind its read-ahead reads each record twice

What to watch

Alert on ages, each labelled by address:

MetricMeasuresA climbing value means
nova_queue_backlog_age_secondsThe oldest unsettled message, from its first sendWorkers do not keep up
nova_queue_claim_age_secondsThe oldest claim a worker still holdsNear the claim TTL, workers die holding messages; far past it, a worker keeps extending
nova_queue_due_lag_secondsHow long the earliest due retry or delayed message has waited to be sent onRetries 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:

PanelWhat it tells you
Queue window held by partWhere the node's queue memory is. entries growing toward the budget while read_ahead stays small is claims nobody settles.
Queue read-ahead targetWhat 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 shareWhat each active seat is owed; it falls as more ranges are consumed on the node
Queue window given backA steady rate means more ranges are consumed on the node than the budget holds
Queue deals by record sourceMostly kept means seats keep up; mostly fetched means they read each record twice
Queue records per fetch readNear 256 means fetches are batched; near 1 means records are fetched one at a time
Queue record fetch failuresA range whose leader or object storage does not answer
Queue ranges waiting for a seatThe 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/emails
purged nova://apps/emails: 7 messages removed
  • Claims a worker holds are taken back. A work session receives revoked with WORK_REFUSAL_CLAIM_GONE, and settling one is refused with claim_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 with PermissionDenied, even with trim. Purge with a token that holds nova: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 modeDelivered again
memoryMessages that were with workers, and acknowledgements since the last save: at most 250 ms of them, or 1,024
persistedNothing; 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

PartBehavior
SendsContinue while the ranges have leaders
Delivery, memory claimsContinues from memory; acks wait in memory and saves retry
Delivery, persisted claimsStops; no claim is delivered without its row
Delivery, durable dedupA range stops at the first idempotent message it reads
Idempotent sends, durable dedupFail with UNAVAILABLE over HTTP and gRPC
Failed attemptsRetried in place at once, without backoff
DelaysHeld in memory; nothing is delivered early
Create, update, delete, list, purgeFail 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

LimitationWhat 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 settledSize the window budget for the ranges consumed at once
Refused work sessions and credit grants are logged but not countedAlert on the log lines
A node keeps a queue's seats for 60 s after its last worker leavesExpect queue memory to fall a minute after workers stop
You cannot purge dead letters or replay chosen onesLet dead_letter_ttl_ms remove them
A replay cut short blocks the next one until 2 minutes after it beganRetry 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 againReplay 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 laterFinish rolling upgrades promptly; see Queues with persisted claims

See also

On this page