Webinar
Introducing EMQX 6.1: Durable MQTT Streams and Analytics-Ready Data | Register Now →

Open MQTT Benchmarking Comparison: EMQX vs NanoMQ

May JinMay Jin
Apr 24, 2023MQTT
Open MQTT Benchmarking Comparison: EMQX vs NanoMQ

The blog post Open MQTT Benchmark Suite: The Ultimate Guide to MQTT Performance Testing introduced the Open MQTT Benchmark Suite developed by EMQ. We defined MQTT benchmark scenarios, use cases, and observation metrics in the GitHub project. Based on the activity and popularity of the community and GitHub project, the top 4 open-source MQTT brokers in 2023 – EMQX, Mosquitto, NanoMQ, and Vernemq, were chosen to perform the benchmark test.

This blog series presents the benchmark test results and aims to help you choose a suitable MQTT broker based on your needs and use cases.

This is the second post of the blog series, which provides the benchmarking results of EMQX and NanoMQ. Additionally, we compare the features and capabilities of both brokers in detail in another post.

MQTT Benchmark Scenarios and Use Cases

The MQTT Benchmark Suite designs two sets of benchmark use cases. One is named Basic Set, which is for small-scale performance verification, and another is called Enterprise Set, which aims for enterprise level verification.

Detailed descriptions of the testing scenarios are already available on the GitHub project. For convenience, we briefly list them here as well.

All the tests are executed on a single node.

Use Cases

Basic Set

  • Point-to-Point: p2p-1K-1K-1K-1K
    • 1k publishers, 1k subscribers, 1k topics
    • Each publisher pubs 1 message per second
    • QoS 1, payload 16B
  • Fan-out: fanout-1-1k-1-1K
    • 1 publisher, 1 topic, 1000 subscribers
    • 1 publisher pubs 1 message per second
    • QoS 1, payload 16B
  • Fan-in: sharedsub-1K-5-1K-1K
    • 1k publishers, 1k pub topics
    • 5 subscribers consume all messages in a shared subscription way
    • Publish rate: 1k/s (each publisher pubs a message per second)
    • Shared subscription’s topic: $share/perf/test/#
    • Publish topics: test/$clientid
    • QoS 1, payload 16B
  • Concurrent connections: conn-tcp-10k-100
    • 10k connections
    • Connection rate (cps): 100/s

Enterprise Set

  • point-to-point: p2p-50K-50K-50K-50K
    • 50k publishers, 50k subscribers, 50k topics
    • Each publisher pubs 1 message per second
    • QoS 1, payload 16B
  • Fan-out: fanout-5-1000-5-250K
    • 5 publishers, 5 topics, 1000 subscribers (each sub to all topics)
    • Publish rate: 250/s, so sub rate = 250*1000 = 250k/s
    • QoS 1, payload 16B
  • Fan-in: sharedsub-50K-500-50K-50K
    • 50k publishers, 50k pub topics
    • Publish rate: 50k/s (each publisher pubs a message per second)
    • Use a shared subscription to consume data (to avoid slow consumption by subscribers affecting broker performance, 500 subscribers are used to share the subscription)
    • Shared subscription’s topic: $share/perf/test/#
    • Publish topics: test/$clientid
    • QoS 1, payload 16B
  • Concurrent connections: conn-tcp-1M-5K
    • 1M connections
    • Connection rate (cps): 5000/s

Common MQTT Config

ConfigValue
keep alive300s
clean sessiontrue
authentication enablementno
TLS authentication enablementno
test duration30 minutes

Testbed

The test environment is configured on AWS, and all virtual machines are within a VPC (virtual private cloud) subnet.

Broker machine Details

  • Public cloud: AWS
  • Instance type: c5.4xlarge 16C32G
  • OS: Ubuntu 22.04.1 amd64

Test Tool

XMeter is used in this benchmark test to simulate various business scenarios. XMeter is built on top of JMeter but with enhanced scalability and more capabilities. It provides comprehensive and real-time test reports during the test. Additionally, its built-in monitoring tools are used to track the resource usage of the EMQX/NanoMQ server, enabling a comparison with the information provided by the operating systems.

XMeter provides a private deployment version (on-premise) and a public cloud SaaS version. A private XMeter is deployed in the same VPC as the MQTT broker server in this testing.

SW Version

BrokerVersion
EMQX4.4.16
NanoMQ0.17.0
XMeter3.2.4

Benchmarking Results

Basic Set

point-to-point: 1K:1K

Average pub-to-sub latency (ms)Max CPU user+systemAvg CPU user+systemMax memory usedAvg memory used
EMQX0.274%2%510M495M
NanoMQ0.251%0%271M270M

Fan-out 1k QoS 1

Average pub-to-sub latency (ms)Max CPU user+systemAvg CPU user+systemMax memory usedAvg memory used
EMQX32%1%475M460M
NanoMQ13.660%0%271M263M

Fan-in 1k - shared subscription QoS 1

Average pub-to-sub latency (ms)Max CPU user+systemAvg CPU user+systemMax memory usedAvg memory used
EMQX0.193%2%468M460M
NanoMQ0.180%0%294M267M

10K connections cps 100

Average latency (ms)Max CPU user+systemAvg CPU user+systemMax memory usedMemory used Stable at
EMQX0.742%1%540M510M
NanoMQ0.590%0%320M320M

Enterprise Set

point-to-point: p2p-50K-50K-50K-50K

Metrics

Actual msg rateAverage pub-to-sub latency (ms)Max CPU user+systemAvg CPU user+systemMax memory usedAvg memory used
EMQX50k:50k1.5888%80%5.71G5.02G
NanoMQ50k:50k9135%30%1.33G1.3G

pub-to-sub latency percentiles

Latency (ms)EMQXNanoMQ
p50182
p751171
p902210
p954225
p9918251

Result Charts

  • EMQX
  • NanoMQ

Fan-out: fanout-5-1000-5-250K

Metrics

Actual msg rateAverage pub-to-sub latency (ms)Max CPU user+systemAvg CPU user+systemMax memory usedAvg memory used
EMQX250k1.9973%71%530M483M
NanoMQ255k13.9173%71%781M682M

pub-to-sub latency percentiles

Latency (ms)EMQXNanoMQ
p50214
p75218
p90321
p95323
p99426

Result Charts

  • EMQX
  • NanoMQ

Fan-in: sharedsub-50K-500-50K-50K

Metrics

Actual msg rateAverage pub-to-sub latency (ms)Max CPU user+systemAvg CPU user+systemMax memory usedAvg memory used
EMQXpub: 50k
sub: 50k
1.4794%93%8.19G6.67G
NanoMQpub: 50k
sub: 50k
2.7634%34%795M783M

pub-to-sub latency percentiles

Latency (ms)EMQXNanoMQ
p5012
p7513
p9024
p9525
p991921

Result Charts

  • EMQX
  • NanoMQ

Concurrent connections: conn-tcp-1M-5K

Metrics

Average latency (ms)Max CPU user+systemAvg CPU user+systemMax memory usedMemory used Stable at
EMQX2.435%22%10.77G8.68G
NanoMQ3.165%4%6.9G6.9G

latency percentiles

Latency (ms)EMQXNanoMQ
p5022
p7522
p9022
p9522
p9933

Result Charts

  • EMQX
  • NanoMQ

Conclusion

The benchmarking results above show that on a single node with the same configuration, EMQX has a smaller latency while NanoMQ uses less Memory and CPU . As mentioned in the blog post, due to the high scalability, reliability and rich features, EMQX is more suitable for deployment in the cloud, providing mission-critical MQTT services for large-scale applications in IoT. NanoMQ, with the nature of lightweight and efficient, is perfect for industrial IoT and IoT applications at the edge.

Try EMQX Enterprise for Free
Connect any device, at any scale, anywhere.
Get Started →

Related Posts