• New
📢 Zilla is now a complete MQTT broker on Kafka: every line of the spec, benchmarked at 100K clients
Learn more →

Engineering

Benchmarks

November 30, 2026

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.

Authors
Ankit Kumar
Team Aklivity

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

ServiceVersionOSInstance typevCPUMemoryCount
Zilla2.8.1Ubuntu 22.04c6i.8xlarge3264 GiB1
Kafka4.1.1, KRaftUbuntu 22.04c6i.8xlarge3264 GiB1
Load generatorsemqtt-bench 0.6.3Ubuntu 22.04c6i.2xlarge816 GiB2
MonitoringPrometheusUbuntu 22.04t3.medium24 GiB1
  • 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

SettingValue
Publishers50,000 MQTT 3.1.1 clients, clean session, 300 s keep-alive
Connection rate5,000 new connections per second
TopicsOne per client, device/
QoS1, one message in flight per client
Payload1 KB
Rate1 msg/s per client, 50,000 msg/s in total
Kafka topicmqtt-devices, 16 partitions, replication factor 1, keyed by MQTT topic
Warm-up60 s after all clients connect
Measurement30 minutes

Kafka Topics

Zilla's mqtt-kafka binding uses three Kafka topics of its own, and the route sends every device/# message to a fourth:

TopicPartitionsReplication factorCleanup policyHolds
mqtt-devices161deleteEvery message published to device/#
mqtt-messages161deleteMessages on topics with no route
mqtt-retained11compactRetained messages
mqtt-sessions11compactMQTT session state

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:

fs.file-max = 2097152
fs.nr_open = 2097152
net.core.somaxconn = 32768
net.ipv4.tcp_max_syn_backlog = 16384
net.ipv4.ip_local_port_range = 1024 65535
net.netfilter.nf_conntrack_max = 1000000

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:

north_mqtt_server:
  type: mqtt
  kind: server
  options:
    store: memory0
  exit: north_mqtt_kafka_mapping
north_mqtt_kafka_mapping:
  type: mqtt-kafka
  kind: proxy
  options:
    topics:
      sessions: mqtt-sessions
      messages: mqtt-messages
      retained: mqtt-retained
  routes:
    - when:
        - publish:
            - topic: device/#
        - subscribe:
            - topic: device/#
      with:
        messages: mqtt-devices
      exit: north_kafka_cache_client
  exit: north_kafka_cache_client

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.

MetricZilla
Publishers connected50,000
Messages into Kafka49,620 msg/s
Messages acknowledged in the window89.3 million
PUBACK p503.6 ms
PUBACK p9920 ms
Zilla host CPU35.4%
Zilla host memory10.0 GiB
Kafka host CPU7.0%

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:

Averagep50p90p99p99.9MaxPUBACKs measured
9.2 ms3.6 ms6.1 ms20 ms2,345 ms5,385 ms179,386

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.

ScenarioWhat it doesQoSPayload
Connection ramp10,000 clients connect at 100 per second and stay connectedn/an/a
Fan-out1 publisher sends 1 msg/s to 1,000 subscribers on one topic1 and 216 B
Point-to-point1,000 publisher and subscriber pairs, one topic per pair, 1 msg/s each1 and 216 B
Shared subscriptions1,000 publishers, 1 msg/s each, to 5 subscribers in one MQTT 5 shared subscription116 B

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

ScenarioMessages in / outDeliveredEnd-to-end avg / p99PUBACK p50 / p99Zilla host CPU
Fan-out, QoS 11 / 955 msg/s95.5%5.0 / 10 ms5.9 / 7.4 ms3.0%
Fan-out, QoS 21 / 986 msg/s98.9%150 / 500 ms18 / 23 ms3.8%
Point-to-point, QoS 11,000 / 980 msg/s98.0%8.5 / 25 ms5.6 / 9.2 ms4.4%
Point-to-point, QoS 2994 / 987 msg/s99.3%153 / 500 ms17 / 77 ms6.6%
Shared subscriptions, QoS 1996 / 996 msg/s100%16.1 / 50 ms2.8%
  • 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.

MetricZilla
Publishers connected99,990
Messages into Kafka76,375 msg/s
Zilla host CPU74%
Zilla host memory18.2 GiB
  • 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:

bin/run-scenario.sh scenarios/mqtt-kafka-50k.env
bin/run-scenario.sh scenarios/basic-conn-10k.env
bin/run-scenario.sh scenarios/basic-fanout-1-1k.env
bin/run-scenario.sh scenarios/basic-fanout-1-1k-q2.env
bin/run-scenario.sh scenarios/basic-p2p-1k.env
bin/run-scenario.sh scenarios/basic-p2p-1k-q2.env
bin/run-scenario.sh scenarios/basic-sharedsub-1k-5.env
bin/run-scenario.sh scenarios/mqtt-kafka-100k.env

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

Engineering

Benchmarks

High-Performance MQTT-Kafka Integration with Zilla: Aklivity Zilla Benchmark Series (Part 5)

Engineering

Benchmarks

Sub-Millisecond Median Overhead for the Zilla LLM Gateway: Aklivity Zilla Benchmark Series (Part 4)

Engineering

What Is a Kafka Gateway and When Is One Needed?

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.

Pricing details

Join the Community

Trade notes with the engineers running Zilla in production, and get help from the team in Slack or Discord.