MQTT Performance Benchmark Testing: EMQX-HStreamDB Integration
IoT scenarios often face challenges like a large number of devices, high data generation rates, and the huge accumulated data volumes. Therefore, how to access, store, and process these massive amounts of data has become a critical issue.
EMQX, as a highly scalable, powerful and feature-rich MQTT broker for the IoT, can handle billions of concurrent connections and millions of messages per second in a single cluster. Furthermore, its built-in Data Integration functionality provides an out-of-the-box solution, which enables seamless integrating IoT data with more than 40 cloud services and enterprise systems, including Kafka, SQL, NoSQL, and time-series databases.
This blog series presents the benchmark test results of the integrations against a single node EMQX server.
HstreamDB is a streaming database purpose-built to ingest, store, process, and analyze massive data streams. It is a modern data infrastructure that unifies messaging, stream processing, and storage to help get value out of your data in real-time.
This blog will provide the benchmarking results of HStreamDB integration - a single node EMQX processes and inserts 100,000 QoS1 messages per second to HStreamDB.
This benchmark testing simulates 100,000 MQTT clients connecting to EMQX, with a connection rate of 5,000 per second. After all connections are established, each client publishes one QoS 1 message per second, and all messages are transmitted and stored in HStreamDB via the rule engine.
- Concurrent connections: 100,000
- Topics: 100,000
- CPS (new established connections per sec.): 5000
- QoS: 1
- Keep alive: 300s
- Payload: json, 200 bytes
- Message publish TPS: 100,000/second
The test environment is configured on Alibaba Cloud, and all virtual machines are within a VPC (virtual private cloud) subnet.
|Cloud Host model
|hserver, hstore in 1 machine
XMeter is used in this benchmark test to simulate MQTT clients. 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 and HStreamDB machines.
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 EMQX and HStream in this testing.
For detailed steps on how to configure EMQX-HStreamDB integration, please refer to EMQX Doc. Figure 2, 3 and 4 are the rule engine settings used in this benchmark testing.
Please refer to EMQX Doc for the Linux Kernel and EMQX tuning.
- CPU and memory stable
- the average of CPU user: 76%
- Memory used: 12GB ~ 16GB
- the average of reponse time of publish: 2.2ms
- After the test was completed, by comparing the data statistics from the EMQX rule engine with the total number of appending in HStreamDB, it was observed that all messages were written to the database in real-time.
Screenshots of EMQX Dashboard & Rule Engine during the test
The above two figures show that the incoming message rate is around 100,000 per second, and all messages hit by the rule are written to the database in real time.
Screenshots after the test completed
From the above screenshots, it can be seen that the total number of queries in the database after the test is consistent with the message count, rule hit count, and success count as shown on the EMQX dashboard.
The benchmarking test shows that a single node EMQX is able to support 100,000 connections and write 100,000 QoS 1 messages with a payload of 200B to HStreamDB per second, and all messages are written to the database in real time. Within the 30-minute test, the CPU and Memory usage has kept stable.
Considering both EMQX and HStreamDB are highly scalable, EMQX-HStream integration can be easily scaled to support higher message throughput and larger data streams, for example, one million messages per second, in a cluster. By leveraging the capabilities of HStreamDB in massive data stream ingestion, storage, processing, and analysis, this out-of-the-box solution provides a robust and scalable infrastructure for IoT usage.