Skip to content

v2.12.0

Latest

Choose a tag to compare

@alice-viola alice-viola released this 03 Dec 09:28
· 6 commits to master since this release

QueenMQ 2.12.0: the image is ghcr.io/queen-mq/queen:2.12.0 (linux/amd64 and linux/arm64), and :latest points at it. The Go client (clients/client-go/v2.12.0) and the Rust client (queen-mq 2.12.0 on crates.io) move to 2.12.0; the other clients stay at their versions and talk to 2.12.0 as to 2.11.0.

Upgrading from 2.11.x: a rolling restart. 2.12.0 keeps the data format of 2.11.0 (cluster
version 8), and nodes of the two releases replicate to each other while the roll runs: nothing
changes on the wire, in the raft log or in the stored state. One answer differs while both run: a
queue's DELETE sent to a 2.11 node while a 2.12 node leads answers 503; send it again, or to a 2.12
node. A node near its memory limit answers 429 overloaded where 2.11 answered 503
memory_pressure, and every SDK waits both out. The Go client moves to 2.12.0 (its streams
runtime, below), and so does the Rust client (its consume loop, below). The other clients stay
where they are: the JavaScript client at 2.9.2, the PHP client at 2.10.0 with supervisor 0.10.0,
the Python and C++ clients at 2.9.0, queen-protocol at 1.7.0 and queenctl at 2.7.1. On three 24-vCPU nodes, 2.12.0 carried 3 million
pushed messages a second, and 1.5 million a second in transactions of 100, with the same median
latency and CPU as 2.11.0 and a p99 within about 1 ms of it. Jepsen ran the whole suite on 2.12
(1b0a7ab1c), 568 tests on 28 VMs, and all were valid; one of them, the S3 sink under kills, ran a
second time, because its rig had no bucket the first time. What came after that commit, the health
score and the console, adds no command to the log.

Server: a node at its memory limit refuses new work and keeps serving; it no longer dies. Break
tests of 2.11.0 on six VMs killed nodes with work a queue is there to absorb: eight pops of 60 MB
read slowly, 17,000 pops waiting at once, 500 Kafka consumers on one node, seven million acks that
dead-lettered their messages, a consumer group's first pop on a leader with millions of
partitions. Each one took a node past its memory limit, and the kernel killed it. In 2.12.0 every
budget is a share of the node's memory limit (the cgroup's, QUEEN_MEMORY_LIMIT_BYTES, or the
machine's memory), so a 512 MiB node no longer starts with budgets made for 4 GiB. The node logs
its memory plan at start: each budget, and whether what it may still take on past the memory
guard's hard level fits in the memory above that level (queen_memory_plan_fits). The guard's
levels move to 70% and 80% of the limit (they were 80 and 90), and a level is held 10 s before
the guard leaves it (QUEEN_MEMGUARD_HOLD_MS): without the hold a 2 GiB node went from hard to
fine and back within 5 s, and was killed between two readings. Past 70%, large reads go one at a
time instead of being refused, so an operator can still list the queues of a full node. Past 80%,
writes that grow the stored state are refused, a pop is served without waiting, and no dead letter
is filed. These refusals answer 429 overloaded with Retry-After, the answer the admission
budget already gave, where 2.11 answered 503 memory_pressure. Acks, lease renewals and deletes
are never refused: they are how a node drains. The price is stored state: a node refuses growth 10
points earlier. Raise both levels for a node that only stores, lower them for one with many
connections. On six VMs each of the five kills ran again, and no node was lost.

Server: answers take memory only as they are written, and a client that stops reading is let
go.
Pops, fetches, feeds, message and trace pages, KV lists and Kafka fetches hold their bytes in
one budget until their last byte is written: 12% of the memory limit, 32 MiB to 4 GiB
(QUEEN_ANSWER_BUDGET_MB), and never more than half of the memory that is free at the moment
(QUEEN_ANSWER_BUDGET_FREE_PCT). A node near its limit serves large answers a few at a time
instead of all at once. An answer under 16 KiB takes nothing from it. A pop answer of up to 4 MiB
(QUEEN_POP_PIECE_BYTES) is sent as in 2.11, byte for byte; a larger one goes out in pieces, each
paid before it is built, and a pop that finds no room within 2 s gives its messages back and
answers 429. A client that takes none of its answer for 30 s is disconnected
(QUEEN_HTTP_WRITE_STALL_MS, QUEEN_POP_PIECE_STALL_MS); one that reads slowly is not, nor is a
long poll that waits for data. A fetch returns at most 64 MiB, whatever it asks
(QUEEN_FETCH_CEILING_BYTES). Feeds and fetches have 64 read slots of their own
(QUEEN_DATA_READS_MAX) and hold one only while they read, not while they wait for data, so
consumers and console pages no longer wait for each other. QUEEN_MAX_CONNECTIONS defaults to what
the memory holds: 20,000 as before from 6 GiB up, fewer below, never under 1,000. A waiting pop
holds 29 kB of its own (it was 42), an idle connection 16 kB.

Server: a request body takes room before it is read. Until 2.12 only pushes and transactions
paid for their body before reading it, so a few dozen 64 MiB ack bodies, KV batches or fetch asks
read at once could take a node down. Now a body of up to 8 KiB is free (QUEEN_BODY_FREE_KB), and
a larger one waits for room in a budget: a write in the push admission budget; an ack, a lease
renewal or a delete in a budget of their own (QUEEN_DRAIN_BODY_BUDGET_MB, 4% of the memory), so
that a drain never waits behind pushes; a read ask in another (QUEEN_ASK_BODY_BUDGET_MB, 2%). A
route that carries only names and ids takes at most 64 KiB (QUEEN_SMALL_BODY_MAX_KB), and a body
sent without Content-Length at most 1 MiB (QUEEN_CHUNKED_BODY_MAX_KB), both answering 413
body_too_large: a body of unknown length could read 64 MiB on a small charge. The push admission
budget is at most 12% of the memory now (a 512 MiB node had 128 MiB, a quarter of it). A body that
stops arriving can be cut with 408 body_stalled (QUEEN_HTTP_BODY_STALL_MS), but that is off by
default: with it on, every push, ack and transaction took about 3 ms longer under load on our test
cluster, and the cause is not found yet. Turn it on for a port that faces untrusted clients.

Server: a consumer group's first pop loads only the partitions that have work. On a leader with
millions of partitions, a group's first pop loaded every partition's state at once: 2.3 million
partitions added 1.67 GB in one pop, the kernel killed the leader, and the same load came back at
every restart. Now the load builds state only for the partitions that have work, and keeps those as
ids until a pop reaches them; idle partitions are not loaded. Two groups load at a time
(QUEEN_CONSUME_LOADS_MAX), and a load that would leave less than 64 MiB or 5% of the memory free
(QUEEN_CONSUME_LOAD_RESERVE_MB) stops: that group's pops answer 429 until there is room, and the
other groups are served. Idle partitions leave the leader's memory sooner when memory is short:
after 30 s past the guard's soft level, at once past its hard level. The leader's memory of recent
transactionIds is a share of the memory too, 25% and at least 32 MiB, without the old 4 GiB floor
(QUEEN_RAFT_DEDUP_FRONT_MB), and it forgets a partition that got no push for 60 s
(QUEEN_RAFT_DEDUP_FRONT_QUIET_S): on a 6 GiB leader, 1.2 million partitions with one message each
in their window took 1.4 GB of it. The raft log's cache is at most 10% of the memory
(QUEEN_RAFT_LOG_CACHE_MB, 512 MiB).

Server: the leader's limits see every write, from every node and from inside the process. With
client offload a follower prepares its clients' commands and the leader only plans them, so the
memory guard and the disk gate, which looked at each node's own clients, never saw what the
followers sent. On a test cluster with the leader's disk 87% full, the leader's own clients got
507 and every write through the followers was accepted; at the hard memory level about 20,000
messages came in through the followers in 12 s, then the kernel killed the leader. The Kafka
facade, the connectors and the embedded API skipped the memory guard too. Now one check, whether
this node may take new data now, runs on every path to the store: on the leader for what followers
forward, before it takes room in the leader's admission budget, and on each node for the callers
inside it. Each second the leader also asks the other voters for their disk and memory state
(QUEEN_RAFT_MEMBER_HEALTH_MS, a field of the raft state call that a 2.11 node ignores), and
refuses new data at once while fewer than a majority can take it, instead of waiting for a commit
that cannot come: a disk past QUEEN_RAFT_DISK_CRITICAL_PCT (95%), or memory past the hard level.
A refused command did not run: 429 for memory, 507 for disk. A retry of a command that already
committed is still answered as committed.

Server: a queue is deleted in steps, and a partition name is never taken twice. Deleting a
queue of 2.9 million partitions on a full cluster wrote one log entry that touched every
partition: no node could apply it, and each one died on it again at every start. Now a delete
takes the partitions first, 4,096 at a time, and the name last, each step a log entry of bounded
size; a tenant purge takes the same steps. While it runs, a push into the queue answers 503
retry, which the SDKs send again, until 30 s after the last step (QUEEN_QUEUE_DELETE_HOLD_MS),
and no partition is created under a name still being swept. On the leader the delete goes on after
its request: past the request's deadline it answers 202 with "deleting": true and
partitionsLeft, and a second DELETE joins the first. This also closes a bug that 2.11 has: a queue
deleted and created again while its partitions were being swept could end with two partitions
under one name, and a key's messages split between them. Apply did not change, so 2.11 and 2.12
nodes end in the same state.

Server: a write the operating system refuses restarts the node instead of stopping it. When a
disk filled up or a node ran out of file descriptors, 2.11 stopped the node and left it up,
stopped, until someone restarted it. Now the broker logs one STORAGE ERROR line that says what to
do and exits with code 75, and its supervisor (Docker's restart policy, Kubernetes) starts it
again; the restart replays the raft log, and nothing of the node's state is lost. At start the
node waits for 256 MiB of free space on its data directory's disk (QUEEN_BOOT_MIN_FREE_MB)
instead of failing again, and raises its soft open-file limit as far as the hard one allows. In
Jepsen's full-disk tests a node went through this up to ten times, and every test was valid. The
embedded library stays stopped, as in 2.11; QUEEN_EXIT_ON_STORAGE_ERROR decides either way.

Server: dead letters are capped as they are filed. Maintenance applies the per-queue caps on
dead letters after the fact, about a thousand deletes a second. Consumers that dead-lettered faster
(72,000 a second, in batches of 1,000 acked dlq) grew every node by 1.3 GB in 40 s and killed the
leader. Now the leader decides at the ack: a dead letter is filed whole, without its body (past
QUEEN_DLQ_MAX_BYTES_TOTAL, as in 2.11), or not at all: when not even its bare row fits, when its
queue already holds twice QUEEN_DLQ_MAX_ROWS_PER_QUEUE while maintenance catches up, or when the
node is past the memory guard's hard level. A dead letter that is not filed changes nothing for the
ack, which succeeds, and the message stays in its queue until its retention;
queen_dlq_not_filed_total counts them by reason. The budget now counts what a dead letter holds
in memory, about 500 bytes for a small one, where 2.11 counted only its stored value, about 100
bytes, and never reached the budget.

Kafka facade: a Fetch takes memory only as it is written, and a client that stops reading is let
go.
500 Kafka consumers on one node filled its memory with Fetch answers waiting to be written.
Now a Fetch holds its room in the budget for answers (QUEEN_ANSWER_BUDGET_MB) until its frame is written, and pays twice
while it encodes. With no room it waits its max_wait_ms, then answers empty with
throttle_time_ms, and the client fetches again (queen_kafka_fetch_no_room_total). A
connection's next Fetch is not read while answers it was given wait to be written, and a client
that takes none of an answer for 30 s is disconnected (QUEEN_KAFKA_WRITE_STALL_MS).

Server: a name too long for the store is refused 413 on every path. A push, a transaction or an
ack whose queue or group name was too long for the store (a 70 KB name) answered 500 internal,
because the reads made before planning built keys the store refused. They now answer 413
name_too_long before any read, as a pop of such a name always did, and so do the reads that name
it.

Server: a rolled-back transaction no longer slows the planning around it. A transaction that
rolls back after its first push made a partition no longer sends its whole planning run back to
one-by-one planning.

Server: a health score, one number for a fast eye. GET /api/v1/status/health answers a
score from 0 to 100 and every check behind it, each with what it measured, the line it judged by
and one sentence for a person. The score is min(cluster, dataAtRisk, 0.6 × cluster + 0.2 × capacity + 0.2 × apps), each part the worst of its checks. The cluster: leader, voters
answering, replication, each node's memory, disk and store map against its own lines, requests
refused in the last 5 and 15 minutes, restarts, the setup. Capacity: CPU over the last 10 minutes
as a share of the CPUs a node may use, connections and waiting pops against their caps. Apps, for
the asking tenant: the oldest unread message, the backlog in minutes of work, ack failures, by the
console's own lines. Data at risk: an unread message past 80% of its queue's retention, which
deletes messages read or not. Capacity or apps alone take the score to 80 at most, both to 60; a
cluster problem or data at risk sets it alone. Bands: 90 fine, 70 watch, 40 act today, 10 act
now, under 10 down. It reads what the console's pages read and changes nothing. Only the cell's
operator sees the nodes: through the proxy, every other caller with read access gets the same score
and its own queues' reasons, with the cluster's reasons about "a node" and no node's name, release
or figures (view: "tenant"). Each node's block of GET /api/v1/raft/members
gains a health object (its guard's lines, its CPU over 10 minutes, its connection caps, its
waiting pops, its refusals), which a 2.11 node does not send: the checks that need it are listed
under notMeasured for that node. The fields are on the HTTP reference.

Go client 2.12.0: a streams answer cut on its way is an error, not an empty state. The streams
runtime ignored the error of reading an answer's body. When a connection dropped in the middle of a
state/get answer, what had arrived was read as the answer: a cut state read came back as no rows,
the reducer started from nothing, and the next cycle wrote that over the stored state. A read error
is now returned, after the usual retries, with the bytes that did arrive; a 2xx whose body is not
the route's JSON object is an error too, and GetState wants the rows list the broker always
sends. A broker of 2.12 closes a connection whose client takes none of an answer for 30 s, so a cut
answer is no longer only a network accident.

Rust client 2.12.0: a consumer's tasks end with it, and a handler that panics fails only its
message.
Two faults in consume() and consume_batch(), reported with reproductions on 2.9.0.
With renew_lease, a handler that panicked left its lease renewal running for the life of the
process: the lease was extended every interval, so its messages never came back and the partition
stayed claimed for the whole consumer group. And dropping the consume future
(tokio::time::timeout, the losing branch of a select!, an aborted parent task) did not stop the
consumer: its workers went on popping, running the handler and acking, even after the client was
dropped. Both came from tasks held only by JoinHandles, which detach their task when dropped. The
workers now live in a JoinSet and each renewal in a guard that aborts it, so dropping the future
stops both at once: a message whose handler was running comes back when its lease expires, as
after a crash, and a Cancel stays the graceful stop. A handler that panics now fails its message
like one that returns Err: the message is nacked with handler panicked: <text> as the reason,
so its retry budget and the DLQ apply, and the consumer goes on. In 2.9 the panic ended its
worker and came back as Error::Network, which is retryable; with concurrency(n) it stayed
hidden while the other workers ran on. Code that restarted a consumer on that error now sees the
message nacked instead. A renewal also stops, with a warning, once the broker answers that the
lease is gone (success: false); it used to ask again every interval without a word.

Console: the new console replaces the first one. The image builds the new console, and the
broker and the proxy embed it at /. The sign-in page has its colours, themes and fonts, and shows
the QueenMQ word alone, as the console does; a failed sign-in has a red ring. One tile at the end of the sidebar holds
you and your cluster, and its menu lists your other clusters. Pages are quieter: words have three
inks, the brightest for what needs you; an alert on the Overview is a name, one fact, why, its last
hour and its buttons (2.11's), up to five of them; cards and long lists have lines between them; a
chart has three value lines and an area under its first line. A button on Workload's first chart,
and on the Overview's Traffic and Delay, opens every chart on the whole screen: each namespace (or
task) with its total, then each of its queues, each on its own scale (?wcharts=1, ?charts=). The
Overview's Waiting has none: the history of what waits is kept for the whole tenant, and a queue's
own takes a read of its own. One namespace holds across the pages
whose rows belong to queues (Queues' tabs, Streams, Connectors and Workload): picked on one, it is
the others' too, and the address keeps it (ns). For it GET /api/v1/dlq takes namespace= (empty:
the queues with none), as GET /api/v1/dlq/signatures did. The console reads less: only Cluster reads the nodes' history, and an alert's causes are
read when you point at it, at most once a minute for each queue. Two numbers were wrong: an alert
counted the failed acks of the whole hour but dated them from the latest run of failures, and
"spread over N partitions" counted empty partitions too.