High-Performance MQTT-Kafka Integration with Zilla: Aklivity Zilla Benchmark Series (Part 5)
One instance of Zilla took 50,000 MQTT clients at QoS 1 and wrote 49,620 msg/s to Kafka, with every PUBACK sent after Kafka acknowledged the write.



Introduction
Part 1, Part 2, and Part 3 of this series measured Aklivity Zilla in front of Apache Kafka, and Part 4 measured Zilla as an LLM gateway.
This post measures Zilla as an MQTT broker for Kafka. MQTT clients connect to Zilla, and Zilla writes every message they publish to a Kafka topic.
The workload models a large fleet of devices: 50,000 clients, one topic per client, QoS 1, 1 KB messages, one message per client per second.
Each client's messages go to one Kafka topic, so the test measures how fast Zilla turns MQTT publishes into Kafka writes.
The Short Version
- Zilla wrote 49,620 messages per second to Kafka over 30 minutes. All 50,000 publishers stayed connected for the whole run.
- Every PUBACK was sent after Kafka acknowledged the write. A publisher that receives a PUBACK knows its message is in Kafka.
- The median PUBACK took 3.6 ms, and p99 took 20 ms.
- Zilla used about 35% of a 32 vCPU host. That is about 11 vCPUs for 50,000 connections and 50,000 msg/s.
- Four more MQTT patterns ran through Kafka. A 10,000-client connection ramp, fan-out and point-to-point at QoS 1 and QoS 2, and shared subscriptions at QoS 1.
- Zilla handled 100,000 MQTT clients on the same hardware. Over 30 minutes at QoS 1 it wrote about 76,000 msg/s to Kafka and ran cleanly from start to finish.
Why MQTT to Kafka
Devices speak MQTT, but the applications that use their data, such as stream processing, analytics, storage and other services, usually read from Kafka. The common setup runs a standalone MQTT broker and moves messages into Kafka with a bridge: the broker's own Kafka integration or a Kafka Connect connector. That is two systems to run and scale, with a hand-off between them.
Zilla speaks MQTT to clients and uses Kafka as its message store:
- One copy of every message. Each publish is written to a Kafka topic, and MQTT subscribers, stream processors and other Kafka consumers all read the same data.
- Acknowledgements backed by Kafka. A PUBACK means the message is in Kafka, not only in broker memory.
- Replay. Kafka keeps messages for as long as the topic's retention allows, so a new consumer can read what was published before it started.
- No separate state store. Sessions and retained messages are kept in Kafka topics too (see Kafka Topics below).
The Trade-off: Latency
Writing to Kafka before acknowledging, and reading back from Kafka before delivering, adds latency:
- PUBACK: the median took 3.6 ms in this benchmark, because Zilla waits for Kafka to acknowledge the write.
- End-to-end at QoS 1: the p99 from publisher to subscriber was 10 to 50 ms, including the Kafka round trip.
- End-to-end at QoS 2: about 150 ms on average, since each message takes a four-step exchange plus the Kafka write.
- A broker that acknowledges from memory and forwards to subscribers directly can answer in under a millisecond, but its PUBACK only means the broker has the message; the copy in Kafka is written afterwards.
When every message has to end up in Kafka, as with telemetry feeding analytics, audit trails or event-driven services, those milliseconds buy a delivery guarantee. For device-to-device messaging that needs the lowest latency and no Kafka, a standalone MQTT broker is the simpler fit.
How We Benchmark
- Separate hosts. Zilla, Kafka, and two load generators each run on their own instance, in one cluster placement group.
- A fixed publish schedule. Each client publishes once a second with one message in flight, so a slow PUBACK shows up as a lower publish rate.
- Two counts of the same messages. The load generators count acknowledged publishes, and the Kafka topic's offsets over the same window agreed with them to within 0.1%.
- A separate latency probe. 100 extra MQTT connections publish one QoS 1 message a second each and time every PUBLISH to its PUBACK.
Benchmark Setup
The run used emqtt-bench as the load generator, with Zilla and Kafka deployed by Terraform and Ansible on AWS EC2 instances.
Infrastructure
- Kafka: apache/kafka:4.1.1 in KRaft mode, a single node, with its log on a gp3 EBS volume (16,000 IOPS, 1,000 MB/s).
- Zilla: started with its default engine settings, which run one engine worker per vCPU.
- Load generator: emqx/emqtt-bench:0.6.3, 25,000 clients on each host.
Workload
Kafka Topics
Zilla's mqtt-kafka binding uses three Kafka topics of its own, and the route sends every device/# message to a fourth:
System Tuning
Default Linux limits stop well short of 50,000 connections, so every host raised the limits on open files, the connection backlog, local ports, and connection tracking:
The Zilla and load generator containers also ran with a limit of 1,048,576 open files. The full list of settings is in 99-mqtt-benchmark.conf.
Zilla MQTT to Kafka Configuration
Bridging MQTT to Kafka with Zilla takes no code, plugins, or separate connector process. Everything is declared in one YAML file: the TCP listener, the MQTT server, the mapping from MQTT topics to Kafka topics, and the Kafka client, in under 70 lines. Sending another set of MQTT topics to a different Kafka topic is one more route in that file, not a code change.
The full configuration is zilla.yaml in the mqtt-benchmark repository. The MQTT part is two bindings: an MQTT server, and an mqtt-kafka proxy that routes every device/# topic to mqtt-devices:
From the proxy, Zilla's Kafka cache and client bindings write each message to Kafka. A memory0 store on the Kafka client binding lets every engine worker share one copy of Kafka's topic metadata.
Zilla at 50,000 Messages per Second
The run had a 60-second warm-up after all 50,000 clients connected, then a 30-minute measurement window.
All 50,000 publishers connected in about 35 seconds and stayed connected for the whole 30-minute window.
The publish rate held at 50,000 msg/s, and the Kafka topic's offsets grew at the same rate. In the last 20 seconds of the window, the rate dropped for about 15 seconds and then recovered.

Most PUBACKs took 1 to 2 ms or 5 to 6 ms. The slowest 1% come mostly from two periods, at about 12 and 26 minutes, when p99 rose above 2 seconds for about a minute while throughput stayed at 50,000 msg/s.

The Zilla host averaged 35% CPU, about 11 of its 32 vCPUs, with short rises during those two periods. The Kafka host averaged 7%.

Memory used on the Zilla host grew from 8.7 to 10.4 GiB over the 30 minutes.

PUBACK Latency
For a QoS 1 publish, Zilla sends the PUBACK once Kafka has acknowledged the write to mqtt-devices. The time from PUBLISH to PUBACK therefore includes the Kafka produce request.
The probe's 100 connections published alongside the 50,000 load clients, on the same Zilla host:
The median stayed between 2.7 and 5.6 ms in every minute of the window. The p99.9 comes from the two periods above, and the maximum from the drop at the end of the window. In the other minutes, p99 stayed between 9 and 164 ms.
Other MQTT Scenarios
Zilla also ran four common MQTT patterns on the same hosts, each with a 5-minute measurement window. Through Zilla, every message goes into Kafka first, and subscribers receive it from Kafka.
Connection ramp
All 10,000 clients connected in 107 seconds, at the requested 100 per second. CONNECT to CONNACK took 7.2 ms on average, and Zilla used 2.2% of the host's CPU while holding the connections.

Messaging scenarios
- End-to-end latency is measured from the publisher's timestamp in each message to the subscriber, and includes the write to Kafka and the read back from it.
- At QoS 2, the PUBACK column is the time from PUBLISH to PUBCOMP.
- Shared subscriptions ran without the PUBACK probe, because the probe's topics would match the shared subscription filter.
At QoS 1, half of the messages reached their subscribers within 5 ms for fan-out, 10 ms for point-to-point and 25 ms for shared subscriptions, and 99% within 10, 25 and 50 ms.

At QoS 2, publisher and subscriber each complete a four-step exchange, and end-to-end latency moves into the 500 ms bucket: about 150 ms on average for both fan-out and point-to-point.

The PUBACK probe ran alongside each messaging scenario. At QoS 1, the median PUBACK took about 6 ms and p99 stayed under 10 ms for both fan-out and point-to-point.

At QoS 2, the probe times PUBLISH to PUBCOMP. Fan-out stayed within 18 to 23 ms up to p99, while point-to-point, with 1,000 publishers, had a longer tail: p99 of 77 ms and p99.9 of 506 ms.

Scaling to 100,000 Clients
Zilla also handled 100,000 MQTT clients on the same infrastructure, one c6i.8xlarge for Zilla and one for Kafka, and stayed stable for the full 30-minute window. Each client published 1 KB at QoS 1 once a second with one message in flight, and clients connected at 5,000 per second.
- Stable for the whole run. Zilla logged no errors, and the rate into Kafka stayed between 74,000 and 81,000 msg/s for all 30 minutes.
- About 76,000 msg/s into Kafka. Each client waits for its PUBACK before publishing again, so at this load the clients sent about 76,000 msg/s in total rather than the full 100,000. About 6,300 connections closed during the run.
On this hardware, 50,000 clients is the load where PUBACKs stay in single-digit milliseconds.
Reproducing the Results
The Terraform, Ansible, and scenario files for these runs are in the mqtt-benchmark repository. Its README has the full steps and prerequisites.
Once the hosts are provisioned and deployed, each scenario is one command:
Closing Thoughts
On one c6i.8xlarge, Zilla took 50,000 MQTT clients publishing 1 KB messages at QoS 1 and wrote 49,620 msg/s to Kafka over 30 minutes. The median PUBACK took 3.6 ms, and Zilla used about 35% of the host's CPU.
Running MQTT straight into Kafka replaces the usual broker-plus-bridge setup with one system: Zilla takes the MQTT connections, writes every message to Kafka, and serves subscribers from Kafka, all from one YAML configuration. Every message lands in a Kafka topic that stream processors, analytics and other services can read and replay, and sessions and retained messages are kept there too.
The cost is latency: a few milliseconds per PUBACK at QoS 1, and more at QoS 2, because each message waits for Kafka. That is the right trade when Kafka is where the data has to end up. When it isn't, and the lowest device-to-device latency matters most, a standalone MQTT broker is the simpler choice.
Each PUBACK in this run meant the message had been written to Kafka. Published MQTT to Kafka results differ in where they draw that line: some brokers acknowledge a message when they receive it and write to Kafka afterwards.
When comparing two results, the question to start with is what a PUBACK confirms: that the broker has the message, or that Kafka does?
Resources
Related Resources


Ready to Get Started?
Get started on your own or request a demo with one of our data management experts.
Explore pricing
Straightforward, usage-based pricing with no per-connection surprises — start free and scale when you are ready.
Join the Community
Trade notes with the engineers running Zilla in production, and get help from the team in Slack or Discord.




