NanoMQ is an open-source edge computing project released in early 2021, designed as a next-generation lightweight and high-performance MQTT message server for IoT edge computing scenarios.
In the IoT era, data is the primary productive force, and the edge is where data is generated. Quickly aggregating and distributing data in complex edge network environments is crucial, and a high real-time and high-throughput edge message bus is essential. However, due to the long industrial chain and historical reasons across various vertical industries, protocol fragmentation and multiple messaging patterns exist at the edge, and the computational power and power consumption in embedded environments are also strictly limited. These issues pose new requirements and challenges for edge message buses.
NanoMQ aims to address these issues by providing a lightweight and high-performance message bus that unifies data flow at the edge. It also offers excellent scalability and portability, adapting to various embedded platforms, allowing fragmented data at the edge to be easily managed and accessed.
Core Advantages
-
Ultra-lightweight: The MQTT service can start with as low as 200Kb of memory usage.
-
Fully Asynchronous I/O: Built-in Actor programming model for IoT and MQTT to parallelize computational loads.
-
Multi-threaded Parallelism: Excellent scalability with good support for multi-core SMP (Symmetric Multi-Processing) and multi-threaded performance.
-
High Performance: Edge processing capability for millions of messages.
-
Cross-platform: Can be seamlessly ported to any POSIX-based system platform.
-
Interoperability: Transparent data, rich extension interfaces, easy integration with various edge computing frameworks.
Features
-
Full Support for MQTT 5.0: Fully supports MQTT 5.0/3.1.1 and is compatible with all standard MQTT open-source SDKs.
-
MQTT Bridging: Built-in multi-cloud bridging capability for MQTT, easily configured to connect various popular cloud services for multi-location data synchronization.
-
Rule Engine: Built-in simple rule engine for flexible handling of edge data. Can also integrate with eKuiper for stream data analysis at the edge.
-
Message Persistence: Designed for complex network environments in IoT, with data persistence and caching capabilities, allowing bridged messages to be cached locally for resending after disconnection. Important data can be persistently updated at the edge.
-
Rich Integration APIs: Provides extensible event-driven WebHook interfaces and operation-friendly HTTP APIs to help reduce the cost of developing and integrating edge computing applications.
-
Multi-protocol Gateway: Supports common messaging protocols such as nanomsg/ZeroMQ/WebSocket through protocol gateways, facilitating the establishment of flexible data routing topologies at the edge. Also provides connection encryption and security assurance.
Product Architecture
NanoMQ is compact yet fully functional, serving as a complete small MQTT edge server + message bus.
-
Platform Adaptation Layer: Detects the hardware platform and operating system it runs on, providing compatible system APIs to avoid platform binding issues.
-
Multi-tasking Layer: Built-in Actor model designed for IoT scenarios, providing thread-level parallel capabilities, effectively scalable on modern SMP systems.
-
Transport Layer: Responsible for managing TCP/UDP streams, including connection management and flow control. Ensures NanoMQ’s Zero-copy feature for various scenarios like QoS, reducing memory consumption and improving performance.
-
Protocol Layer: Converts data streams into MQTT messages and generates different events based on the MQTT protocol, exposing interfaces. Also manages the message flight windows for various clients.
-
Application Layer: Implements the rule engine and the global MQTT topic tree, reading configurations for corresponding bridging and message forwarding functions. Exposes all MQTT message events and HTTP APIs to users.
Installation and Deployment
NanoMQ is an open-source project under the MIT license, and you can obtain the complete code on GitHub.
https://github.com/emqx/nanomq
Run the following command to quickly start NanoMQ via Docker, specifying ports 1883, 8083, and 8883 for listening to 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 a 4C8G host, it can support up to 120K connections. With 60K clients subscribing to different 60K topics, another 60K clients publish 16kb messages to these 60K topics at 1000ms intervals.
Load Testing Environment 4C8G Server
-
Operating System: CentOS Linux release 7.6.1708
-
CPU : 4 cores 4 threads
-
Memory: 8 G
-
NanoMQ Version: Version 0.3.4, 4 threads, 64 contexts. Logging/statistics and debugging features turned off.
Load Testing Results:
Conclusion
NanoMQ relies solely on native POSIX APIs, boasting high compatibility and portability, lightweight, fast, and extremely low memory usage, making it an excellent open-source MQTT component for industrial IoT edge scenarios.
Additionally, NanoMQ can serve as a message bus, converting protocols like DDS, NNG, and ZeroMQ into MQTT, and then bridging MQTT messages to the cloud.
Visit the official NanoMQ site at https://nanomq.io
Previous Recommendations
☞ 2022 IoT Platform Trends: Privatization
☞ 5 Lessons Learned from IoT Startup Failures
☞ Comparison of 4 Major IoT Platforms in China
☞ Are Cloud Vendors’ [IoT Platforms] Not Attractive Anymore?



