← All projects
Project record1 mention
Originally shared on Hacker News

QueenMQ

QueenMQ is an open-source (Apache 2.0) message broker, built at Smartness over a year, implemented as a single Rust binary with data replicated on disk by Raft. It has dynamic (not preallocated) partitions tested up to 10 million, one Raft leader per tenant, RabbitMQ-style ACK/NACK/retries/DLQ, etcd-like transactions over a linearizable replicated KV store, streaming features with a single ordered log, thin HTTP clients, and Kafka compatibility. It sustains 3M msg/s of 256-byte messages with p99 latency around 20 ms on three machines and was tested with 226 Jepsen-library tests on up to 5 nodes.

Last shared
01 / The problem

What it addresses

Kafka used as a message queue caused head-of-line blocking: an LLM call taking seconds to minutes blocked every other chat in the same partition. The team first worked around it by saving Kafka messages in Postgres ordered by entity (e.g., chat_id), then built QueenMQ so head-of-line blocking is confined to a single partition representing one business entity.

02 / Source history

Shared over time

Each entry reflects what was shared on that date. Details may have changed since then.

  1. QueenMQ

    QueenMQ is an open-source (Apache 2.0) message broker, built at Smartness over a year, implemented as a single Rust binary with data replicated on disk by Raft. It has dynamic (not preallocated) partitions tested up to 10 million, one Raft leader per tenant, RabbitMQ-style ACK/NACK/retries/DLQ, etcd-like transactions over a linearizable replicated KV store, streaming features with a single ordered log, thin HTTP clients, and Kafka compatibility. It sustains 3M msg/s of 256-byte messages with p99 latency around 20 ms on three machines and was tested with 226 Jepsen-library tests on up to 5 nodes.

    Problem: Kafka used as a message queue caused head-of-line blocking: an LLM call taking seconds to minutes blocked every other chat in the same partition. The team first worked around it by saving Kafka messages in Postgres ordered by entity (e.g., chat_id), then built QueenMQ so head-of-line blocking is confined to a single partition representing one business entity.

    Posted by @aliceviola · Original source ↗

    Story title · @aliceviola · · Source ↗

    Show HN: QueenMQ – slow LLM calls blocked our Kafka partitions, so we built it

    Submitted URL · @aliceviola · · Source ↗

    https://github.com/queen-mq/queen

    Source text · @aliceviola · · Source ↗

    Over the last year, at Smartness, the company where I work, we built a new message broker, open source under Apache 2.0.

    Source text · @aliceviola · · Source ↗

    In this product head-of-line blocking hurt a lot: an LLM call takes seconds to minutes, and it blocked every other chat in the same partition.

    Source text · @aliceviola · · Source ↗

    We first built a hack: we saved the Kafka messages in Postgres, ordered by the entity we needed (a chat_id, for example), processed them, and sent them back to Kafka. Then we decided to build a real broker on that idea.

    Source text · @aliceviola · · Source ↗

    It took a year, from C++ plus Postgres to, today, a single Rust binary with data replicated on disk by Raft.

    Source text · @aliceviola · · Source ↗

    Like Kafka, it has partitions, but in QueenMQ they are dynamic (not preallocated) and you can use a lot of them (tested up to 10 million).

    Source text · @aliceviola · · Source ↗

    Like RabbitMQ, it has ACK, NACK, retries and a DLQ: this makes it a message queue.

    Source text · @aliceviola · · Source ↗

    thanks to its etcd-like design, it runs transactions that include ACKs, pushes to other queues, KV writes and timers, and it has atomic locks.

    Source text · @aliceviola · · Source ↗

    Clients talk to it over HTTP (the clients are thin, the intelligence is in the broker), and it is Kafka-compatible (although that way you cannot use all of its strengths).

    Source text · @aliceviola · · Source ↗

    On three beefy machines (24 vCPU, NVMe, 88 GB of RAM), QueenMQ sustains 3M msg/s of 256-byte messages, up to 10M partitions, with p99 latency around 20 ms and every write fsynced on two nodes.

    Source text · @aliceviola · · Source ↗

    We tested it hard: 226 tests of our own, written with the Jepsen library, on up to 5 nodes.

    Source text · @aliceviola · · Source ↗

    docker run -p 6632:6632 ghcr.io/queen-mq/queen:2.8.0