NanoMQ is a lightweight, high-performance MQTT gateway in domestic open source IIoT edge scenarios

334e9a12b0d9de9fbc14a03eb87a1d95.png

NanoMQ is an edge computing open source project released in early 2021. It is a next-generation lightweight and high-performance MQTT message server for IoT edge computing scenarios.

In the IoT era, data is the primary productivity, and the edge is where data is born. To quickly aggregate and distribute data in a complex network environment at the edge, a high-real-time, high-throughput edge message bus is crucial. However, due to the long industrial chain and the historical reasons of various vertical industries, there are protocol fragmentation and multiple message modes on the edge , and the computing power and power consumption of the embedded environment are also strictly limited . These problems have put forward new requirements and challenges for the edge message bus.

NanoMQ is committed to solving these problems, providing a lightweight high-performance message bus that can unify data flow at the edge. At the same time, it provides excellent scalability and portability, adapts to various embedded platforms, and allows fragmented data scattered at the edge to be easily managed and obtained.

core advantages

  • Ultra-lightweight: The MQTT service can be started with a memory footprint as low as 200Kb.

  • Fully asynchronous I/O: Actor programming model built-in for IoT and MQTT to parallelize computing load.

  • Multi-thread parallelism: excellent scalability, good multi-core SMP (symmetric multiprocessing) support and multi-thread performance.

  • High performance: million-level message processing capability at the edge.

  • Cross-platform: It can be seamlessly ported to any POSIX-based system platform.

  • Interoperability: Data transparency, rich expansion interfaces, and easy integration with various edge computing frameworks.

Features

  • Full support for MQTT 5.0: full support for MQTT 5.0/3.1.1, compatible with all standard MQTT open source SDKs.

  • MQTT bridging: Built-in MQTT multi-cloud bridging function, simple configuration can access various popular cloud services to establish cloud-side channels for data synchronization in multiple places.

  • Rule engine: The built-in simple rule engine can flexibly process edge data. It can also be integrated with eKuiper for streaming data analysis at the edge.

  • Message persistence: Design data persistence and data caching functions for complex network environment scenarios of the Internet of Things. Bridge messages can be cached locally and then resumed after network interruption. Important data can be persisted and rolled over at the edge.

  • Rich integration APIs: Provides scalable event-driven WebHook interfaces and O&M-friendly HTTP APIs to help reduce the cost of edge computing application development and integration.

  • Multi-protocol gateway: The protocol gateway supports commonly used message protocols such as nanomsg/ZeroMQ/Websocket, which facilitates the establishment of flexible data routing topologies at the edge. And provide connection encryption and security.

product architecture

a5bf670edad22e67924cdffc58d4233d.png

NanoMQ is small but complete. It is a small MQTT edge server + message bus with complete functions in all aspects.

  • Platform adaptation layer: detect the running hardware platform operating system, provide an adapted system API, and avoid platform binding problems.

  • Multi-tasking layer: Built-in Actor model designed for IoT scenarios, providing thread-level parallel capabilities, and can be effectively expanded on modern SMP systems.

  • Transport layer: The transport layer is responsible for managing TCP/UDP streams, including connection management and flow control. It also guarantees the Zero-copy feature of NanoMQ for different scenarios such as QoS, reduces memory consumption and improves performance.

  • Protocol layer: Convert the data flow into MQTT messages, and generate different events and expose interfaces for the MQTT protocol. At the same time, the protocol layer is also responsible for managing the message flight window of each client.

  • Application layer: implement the rule engine and MQTT global topic tree, and read the configuration for corresponding bridging and message forwarding functions. And expose all MQTT message events and HTTP API to users.

Install and deploy

NanoMQ is an open source project under the MIT license, you can get the complete code on Github

https://github.com/emqx/nanomq

Run the following commands to quickly run NanoMQ through Docker, specifying ports 1883, 8083, and 8883 to listen for MQTT, MQTT over WebSockets, and MQTT over SSL/TLS traffic, respectively.

docker run -d --name nanomq -p 1883:1883 -p 8083:8083 -p 8883:8883  emqx/nanomq:latest

Performance Testing

On the 4C8G host, it can support up to 120K connections . 60K clients subscribe to different 60K topics, and another 60K clients send 16kb publish messages to these 60K topics at an interval of 1000ms. 

Pressure test environment  4C8G server

  • Operating system: CentOS Linux release 7.6.1708

  • CPU: 4 cores 4 threads 

  • Memory: 8G

  • NanoMQ version: version 0.3.4, 4 threads, 64 contexts. Turn off logging/statistics and debugging.

Pressure test results:

3c16b261e70577ee8304ce1bb69b1b51.png

93f0e63d73cc8021f866b8369b8b26d9.png

Summarize

NanoMQ only relies on the native POSIX API. It has high compatibility and portability, lightweight, fast, and extremely low memory footprint , making it an open source that performs very well in edge scenarios of the Industrial Internet of Things. MQTT component.

In addition, NanoMQ can also be used as a message bus, converting protocols such as DDS, NNG, and ZeroMQ into MQTT, and then bridging MQTT messages to the cloud.

NanoMQ official website https://nanomq.io

​​

Past recommendation

☞ IDC China 2022 IoT Platform Evaluation Report

☞ IoT Platform Trends in 2022: Privatization

☞ 5 failed lessons worth sharing about Internet of Things startups

☞ Selection and comparison of four domestic IoT platforms

☞ Is the [IoT platform] of cloud vendors not popular?

02a93ed24dd6bbe8b16ff8f7920dbeb0.png

85e681b362ce084a3e75360f7f11cab3.gif

bfd8f08b1d7cee40c3ce164e5758010b.gif

30d1b91ce1949ff02f4d3aa1f73ed19a.gif

6e6f0242889e5e032af115ec08629b8c.gif

Guess you like

Origin blog.csdn.net/klandor2008/article/details/131887091