Skip to content

v2.1.0 — memory & latency: 8 MiB baseline, sub-Mosquitto latency

Choose a tag to compare

@iamaliybi iamaliybi released this 08 Jul 19:05
6b63564

Memory & latency optimization, aligned with thread-per-core: the empty-broker footprint is more than halved and single-message latency can now beat Mosquitto's — both from tuning the glommio runtime, with zero throughput regression and no architectural change. Two new [runtime] knobs.

[runtime] io_memory_kib (default 512)

glommio pre-allocates and pins a 10 MiB io_uring registered-buffer pool per core at startup — resident for the shard's whole life, and the dominant term in the empty-broker footprint. The network fast path (recv/send) never draws from it; only DMA file I/O (persistence snapshots) does, and that falls back to the heap when exhausted, so shrinking it is safe (glommio's 64 KiB floor enforced).

Empty-broker RSS v2.0.0 v2.1.0 Mosquitto 2.0.18
1 shard 17.6 MiB 8.1 MiB 7.6
4 shards 51.7 MiB 13.1 MiB

Verified with zero regression: saturating QoS 1 unchanged (79.4k/core, 359k on 3 shards), parked-idle floor unchanged (0.68 KiB/conn), adversarial battery still 12/12. Bonus: the small pinned pool keeps multi-shard within a tight RLIMIT_MEMLOCK, so multi-shard now starts on memlock-constrained hosts that the 10 MiB×N default could push into io_uring ENOMEM.

[runtime] spin_before_park_us (default 0 = off)

Busy-polls io_uring completions for this many microseconds before parking the reactor, removing the park/unpark round-trip from single-message latency. Measured at 50 µs: PUBLISH→PUBACK RTT p50 37 → 27 µs — below Mosquitto's 31.9 µs. Opt-in because spinning trades idle CPU for the latency; suited to latency-critical, steadily-busy shards. Effective only under max-spread/max-pack placement.

Notes

Per-connection cost is unchanged (idle 6.24, active 7.56 KiB/conn) — this release lowers the fixed baseline and unlocks cheap multi-shard, not the per-connection constant. Total footprint still improves markedly: a 500-connection active broker drops 21.4 → 11.8 MiB (−45%) from the baseline win alone. Closing the per-connection constant is the dispatcher-mode program (.agents/next-steps.md §1), whose A0 design study landed this cycle; the rewrite is gated to the next release behind a prototype.

Assets: rusquitto-x86_64-unknown-linux-gnu, rusquitto-aarch64-unknown-linux-gnu (zig-built against glibc 2.31), and the annotated rusquitto.config.toml. Full details in CHANGELOG.md.