Repository navigation
This release is about memory. A broker with many idle queues and connections uses far less of it, and stops for shorter garbage collections: at 100k idle queues stats history alone saves about 1.4 GB, and garbage collection pauses drop from ~240 ms to ~55 ms with 20k queues and 2,000 connections. Clusters fail over more reliably: two ways a cluster could be left without a leader are fixed, and the paused state of queues, streams, MQTT sessions and shovels is replicated. A queue, stream or MQTT session is paused when its message store fails, instead of closed. MQTT sessions can be paused and resumed, and MQTT deliveries are batched into one socket write per burst. Automatic retries can be tuned by policy, HTTP stream reads accept a timestamp as offset, and the queue page has a refreshed layout and charts queued messages.
Release Highlights
Much Less Memory for Idle Queues and Connections
- A stat keeps a history buffer only while its value changes, so idle queues, exchanges, channels and connections cost almost nothing. At 100k idle queues that saves about 1.4 GB #2618
- Idle queues release the segment they write to from memory. That segment otherwise stayed mapped until it filled up, up to
segment_sizeper queue, which with many idle queues added up to gigabytes #2702 /api/overviewis served in 4 ms instead of 62 ms at 100k queues #2617
Shorter Garbage Collection Pauses
LavinMQ now links libgc from cloudamqp/bdwgc. With libgc 8.2.12, every garbage collection with thousands of connections and queues rescanned the whole heap. With 20k queues and 2,000 connections, pauses drop from ~240 ms to ~55 ms. Set GC_DISABLE_GROW_MARK_STACK=1 to switch it off. #2689
More Reliable Failover
- A node that lost its etcd lease keepalives after a single
etcdserver: no leaderanswer kept running, and hung at the next failover. Keepalives are now retried, and a node exits once no keepalive has succeeded within the lease TTL #2749 - A node stopped in the second after it won the leader election no longer becomes leader and exits, leaving the cluster without a leader #2726
- Pausing a queue, stream, MQTT session or shovel is replicated, so the pause survives a failover. A pause or resume through the API returns once the followers have it #2742 #2861
- Followers forward client connections to the ports the leader listens on, and pass on a trusted load balancer's PROXY header #2761 #2758
Paused Instead of Closed on Message Store Errors
A queue, stream or MQTT session is no longer closed when its message store fails. After a temporary store error it's paused: resume it to try again. If its message data can't be read, it's in the new failed state: delete it, or fail over to a node with a good copy. Publishes to a failed queue are nacked. paused_reason in the HTTP API and the queue and stream pages say why a queue is paused, and the queue list marks failed queues. #2781 #2869
MQTT: Pause Sessions, Faster Deliveries
- MQTT sessions can be paused and resumed through the HTTP API, the management UI and
lavinmqctl, like queues. The pause is kept when the broker restarts #2781 - Deliveries are batched into one socket write per burst, which cuts server CPU per QoS 0 delivery from 9.3 µs to 1.5 µs (110k to 710k msg/s) #2570
- SUBSCRIBE, UNSUBSCRIBE and deleting a session no longer walk every subscription in the vhost #2558
Changes Worth Mentioning
- Policy keys
delayed-retry-min,delayed-retry-multiplieranddelayed-retry-maxtune the retry backoff of queues declared withx-delayed-retry-min#2415 - HTTP stream reads (
POST /api/queues/:vhost/:name/stream) accept an ISO 8601 timestamp asoffset#2386 - A
SIGHUPconfig reload applies changes toauth_backendsand to the[oauth]issuerandjwks_cache_ttl#2451 - Prometheus metrics
mqtt_connectionsandglobal_mqtt_messages_published_totalper QoS level #2507 - The queue and stream pages chart queued messages, the queue page has a refreshed layout, and the "Add" forms open in a dialog #2581 #2787 #2479
- HTTP API responses up to 32 KB are sent with Content-Length, so calls over kept-alive connections no longer stall 40 ms waiting for a delayed ACK #2548
- Requeuing many messages from a stream at once, e.g. a
basic.nackof 65,535 messages, no longer stalls the consumer for 32 s #2699 - Pre-release deb packages are versioned with a tilde, such as
2.12.0~rc.1-1, so they sort below the final release #2740
Notable Fixes
- A message delivered to a no-ack consumer of a connection that the client was closing could be lost #2545
- An MQTT session could send packet ID 0, and hung the server when every packet ID but one was in flight #2556
- An MQTT subscriber that acknowledged a QoS 1 message while it was still being sent was disconnected and had its will published #2557
- A stream consumer could stop receiving messages after the stream failed to create a segment #2830
- A stream with an empty segment left by an unclean stop failed when a consumer read across it #2860
- After more than 10 failed reconnects in a row, a shovel could stop reconnecting for good; with the default
reconnect-delayof 5 seconds, after about 53 minutes #2606 - Clearing a vhost's connection or queue limit was not saved or replicated, so the old limit came back after a restart or a leader change #2591
- Declaring a queue with
x-dead-letter-exchangechecked read permission on the connection name instead of the queue #2594
Breaking Changes / Upgrade Notes
Invalid boolean config values stop startup
An unrecognised value for a boolean setting now stops LavinMQ from starting, or fails a config reload, with an error naming the setting. This includes an empty value, e.g. LAVINMQ_SYNC=, and a value followed by an inline comment, e.g. sync = false # note. All of these were silently read as false. #2338
Data directories from before LavinMQ 1.0 are refused
Migration of data directories created by LavinMQ < 1.0 is removed. Upgrade such a data directory with LavinMQ 2.11 first. #2482
Known issue: a data directory that lost its schema_version file in a crash is also refused, and the error says to upgrade it with 2.11. Don't downgrade: #2870 fixes it in the next patch. #2763
Streams paused on 2.11 start paused
A paused stream now stays paused across restarts. 2.11 ran such a stream again after a restart, but left a paused file in the stream's directory, so 2.12 starts it paused. Look for streams that have one, or resume them after the upgrade. #2781 #2850
Queue restart is removed
PUT /api/queues/:vhost/:name/restart, lavinmqctl restart_queue and the "Restart queue" button are removed, since a queue is no longer closed on a store error. #2781
Config reloads
- A
SIGHUPreload resets a setting removed from the config file to its default, instead of keeping its previous value #2458 - An unsupported
auth_backendsvalue is rejected when the config is parsed #2451 stats_log_sizemust be at least 1. The config refuses 0 and negative values, also at startup #2615
Stricter API and policies
- In a cluster, pausing or resuming a queue, MQTT session or shovel returns once the followers have the change, which takes about 3 s when a follower doesn't respond #2861
- Creating an operator policy with a key that is not allowed fails with 400 instead of 500 #2596
- The
delayed-messagepolicy key, which never had any effect, is removed. A policy that sets it is still accepted and ignored #2772
For the full list of changes, see the changelog.