A Practical Guide To MQTT Broker Selection
A Practical Guide To MQTT Broker Selection
A Practical Guide To MQTT Broker Selection
Tables of Content
Introduction .................................................................................................................. 1
Security ..................................................................................................................................4
Performance ........................................................................................................................11
Cost ......................................................................................................................................13
EMQX ................................................................................................................................... 15
Mosquitto ............................................................................................................................ 16
NanoMQ ...............................................................................................................................18
VerneMQ ..............................................................................................................................19
Conclusion .................................................................................................................. 27
Introduction
The MQTT Broker plays a crucial role in facilitating messaging between IoT devices,
making it a key component in IoT applications. As such, selecting the appropriate MQTT
Broker serves as the initial and most critical step in an IoT project.
This eBook offers a comprehensive guide to MQTT broker selection for IoT service
providers. We will begin by discussing important factors to consider and potential
concerns based on typical requirements and scenarios in IoT projects. Next, we will
explore popular MQTT brokers in detail, examining their advantages and disadvantages.
To assist you further, we will include a side-by-side comparison, allowing you to
determine the best-suited broker for your specific projects.
You will understand how to choose an MQTT Broker that aligns with your unique needs
and requirements through this eBook. Join us as we navigate the world of MQTT brokers
and empower you to make informed decisions.
Before embarking on the selection process, we recommend you have the following
questions firmly answered in your mind:
• What is the expected scale of devices of your project in the long run?
• What are the necessary performance metrics? How essential are message latency and
• Where will the MQTT Broker be located? How will you leverage the data?
• What are the characteristics of your data? Is message size and frequency a necessary
consideration?
• How do you process IoT data in your application, including the preferred programming
These questions will help you identify the features and functionalities that you need from
the MQTT Broker.
If the MQTT Broker is like a port, message delivery is only the transportation of goods. In
fact, to ensure the transportation of goods, a complete logistics system and storage
facilities are required to provide essential support. To send goods from various places to
different destinations, it is necessary to unpack and repack the goods and use different
logistics methods to deliver them. In the off-season and peak season of logistics, it is
necessary to adjust the scale of port facilities and personnel dynamically and flexibly to
In the context of MQTT Broker, these requirements correspond to security, fault handling,
and metrics monitoring for basic operation, data processing and integration capabilities
for MQTT messaging, and scalability for the entire service.
Next, we will discuss these features in more detail to help you choose the most suitable
MQTT Broker for your project.
Security
Security is a key factor to consider when choosing an MQTT Broker, and the following
aspects are important to keep in mind.
Client Authentication
The MQTT client authentication requires clients to provide specific credentials to confirm
their identity when connecting to the MQTT Broker. Here are the commonly used
authentication methods and their requirements for the MQTT Broker:
Authorization is the process of verifying the operational privileges of clients for a specific
topic before they can publish or subscribe. Permission lists are usually stored in
databases, either internal or external, and need to be updated in real time to reflect
business changes.
The following are some typical requirements for the authorization function:
Fine-grained access control Able to meet the access control needs of various levels.
The software industry has gained valuable insights from past experiences, recognizing
that security vulnerabilities in software can substantially affect an enterprise's operations.
• Open source validation: check the Broker's code openness and the level of its
• Security integration: check the sufficiency of security testing and protection, and the
An MQTT Broker cluster is a system that distributes the workload of connecting and
messaging among multiple MQTT Brokers (also known as nodes).
Clients can interact with the cluster as a unified entity without being aware of the internal
workings or any changes in the number of nodes. The cluster handles connections and
also publishes and subscribes messages, just like a single node.
Imagine that you have a car equipped with IoT capabilities. As it floods the market, with
monthly sales reaching thousands to tens of thousands of units, your MQTT Broker needs
to prepare for a potential surge in connections, ranging from tens of thousands to millions,
in the coming years. With the OTA upgrades of the vehicle system, more data is expected
With a cluster-supported MQTT Broker, you have the ability to add nodes to the cluster at
runtime, enabling easy horizontal scaling to accommodate an increasing number of MQTT
messages and client connections.
Not every application is required to handle the demands of business expansion. For
instance, if your business is solely focused on environmental monitoring in a particular
school or manufacturing facility, the volume of clients and messages can be anticipated to
remain consistent for several years, even without any alterations.
You might have noticed that a solitary MQTT broker has the capacity to accommodate
tens of thousands of clients, which is adequate for the majority of IoT applications. In light
of this, is it essential to implement clustering?
Indeed, it is. An MQTT Broker cluster can persist in functioning even when certain node
failures, guaranteeing that there is no single point of failure and that the service remains
accessible at all times.
Therefore, if you need your application to be reliable, you should select an MQTT Broker
that supports clustering.
Implementing all these features is a complex undertaking, which is why the deployment of
most MQTT Brokers is restricted to a single node. However, recognizing the significance of
scalability and high availability, some of these Brokers offer specialized implementation
solutions.
Using MQTT message publishing and subscribing to exchange messages among multiple
Brokers provides some level of scalability, allowing more clients to connect and interact
with each other. However, this mode of communication is known to be highly inefficient
and does not ensure high availability.
One way to achieve high availability of MQTT Brokers is to run multiple instances
simultaneously and perform full synchronization of session state among nodes. If a node
fails, load balancing can quickly switch to another node, providing single-machine hot
backups and avoiding any disruption to IoT applications. However, it is important to note
that this method may not be the best choice for scaling and can lead to increased costs.
Although the above solutions are functional, it does not provide both scalability and high
availability at the same time, and can also complicate the deployment process. To simplify
the creation of reliable IoT services that can scale as needed, it is recommended to choose
MQTT Brokers that support clustering themselves.
When developing IoT applications, it's often essential to enable data exchange among
For instance, data collected from sensors on a factory line can be sent to accompanying
MES and ERP systems via an MQTT Broker. To establish a reliable connection between the
two systems, a database or an event-driven message queue like Apache Kafka can serve
as a bridge.
Similarly, weather sensor data scattered across a city can be gathered and stored in a
time-series database like InfluxDB for thorough analysis, enabling the data's full potential
to be realized.
You may also need to filter, encode, or otherwise process the data before saving it to meet
the actual business needs.
Some MQTT Brokers offer a built-in rule engine that facilitates data processing by
enabling users to create data-driven rules on the Broker and send results to data
integration. Typically, this functionality can be configured using low-code tools such as
SQL or form.
Performance
MQTT Broker is used to connect a large number of clients and enable massive messaging,
where the following performance metrics need to be considered:
2. Message transmission latency: The time it takes for a message to be sent from the
sender to the receiver, and is primarily dependent on the performance of the MQTT
Broker, assuming a consistent network environment.
3. Message send/receive rate: The number of messages that can be sent or received per
second by the MQTT Broker.
While performance is essential, it's not the only thing to look for in an MQTT Broker. A
high-performing broker usually excels in other areas too, but don't rely solely on
performance metrics to evaluate it, unless it's significantly underperforming.
Besides, it is important to note that the performance metrics reported by an MQTT Broker
are based on a specific scenario, and various factors such as message rate, topic level,
message QoS, message payload size, and the status of the rule engine can influence the
outcomes.
Moreover, any Broker can claim a performance metric that is hard to replicate and
irrelevant to the users. If you have high performance demands, please carefully examine
whether its technology can deliver the expected results and whether its test results can be
reproduced. Real knowledge comes from practice, so it is best to conduct a stress test
based on your own application scenarios.
Cloud Native
To achieve these goals, it is crucial for the scalability and management functionalities of
the MQTT Broker to be tightly integrated with the underlying capabilities of the cloud
infrastructure. However, in reality, the level of Cloud-Native implementation varies among
different Brokers.
Support Extensions
A single software solution cannot fulfill the requirements of all users. To accommodate
specific requirements, such as support for multiple message transfer protocols, custom
authentication and authorization, specialized data encryption methods, and monitoring
and alert capabilities, it may be necessary to extend the functionality of the MQTT Broker.
To facilitate this, the MQTT Broker must provide an appropriate extension mechanism,
such as a plugin architecture, to enable customization when needed. Additionally, it should
support mainstream programming languages for extension development.
Cost
Depending on your needs, you may opt for enterprise services or an open-source MQTT
Broker. There are many open-source MQTT Brokers available, which can typically be
deployed without incurring any licensing fees if the open-source license allows it. However,
installation, maintenance, and extension development may require additional resources.
When deploying MQTT Brokers for large-scale applications, it's essential to assess their
performance and consider the costs associated with them. High-performance MQTT
Brokers can significantly reduce the overheads associated with hardware, network, and
When choosing a managed MQTT cloud service, it is essential to understand how billing
works, as it usually depends on the number of connections and the amount of traffic. You
should review the details of each billing option carefully and select the most cost-effective
option for your specific use case.
Additional Considerations
In addition to the MQTT Broker itself, there are several other factors to consider:
Choose MQTT Broker providers who deliver regional or global services, as they help
enterprises to get quicker technical support, accelerate delivery and cut costs
substantially.
To minimize investment risks and costs when selecting MQTT Brokers or technologies
for IoT projects, it is advisable to opt for established solutions with a proven track
record in the industry. Developing systems from scratch should be avoided as it can be
time-consuming, costly, and potentially risky.
When deploying at the edge, it is important to select an MQTT Broker that has low
resource consumption, is optimized for edge environments, or has a proven cloud-edge
solution.
EMQX
EMQX is one of the most popular MQTT brokers and has 11.5k stars on GitHub. The EMQX
project was launched in 2012 and is licensed under Apache version 2.0. EMQX is written in
Erlang/OTP, a programming language for building massively scalable soft real-time
systems.
EMQX is the world's most scalable MQTT broker that supports advanced features such as
MQTT 5.0, MQTT-SN, and MQTT over QUIC. It supports masterless clustering for high
availability and horizontal scalability. EMQX 5.0, the latest version, scales to establish 100
million concurrent MQTT connections with a single cluster of 23 nodes.
EMQX offers rich enterprise features, data integration, cloud hosting services, and
commercial support from EMQ Technologies Inc. Over the years, EMQX has gained
popularity among enterprises, startups, and individuals due to its performance, reliability,
and scalability. EMQX is widely used for business-critical applications in various
industries, such as IoT, industrial IoT, connected cars, manufacturing, and
telecommunications.
Pros:
• High availability
• Horizontal scalability
Cons:
Mosquitto
The Mosquitto project was initially developed by Roger Light in 2009 and later donated to
the Eclipse Foundation, licensed under the Eclipse Public License (EPL/EDL license). As of
March 2023, it is the most widely deployed open-source MQTT broker with a large
community and over 7k GitHub stars.
Mosquitto is known for its small booting footprint of about 200k. However, it does not
provide native support for multi-threading or clustering. Mosquitto is available for various
platforms, including Linux, Windows, and macOS.
Pros:
Cons:
• Single-threaded architecture
NanoMQ
Pros:
• Lightweight design
• Highly portable
• Easy to deploy
Cons:
• No clustering support
VerneMQ
The VerneMQ project was launched in 2014 and initially developed by Erlio GmbH. The
project is licensed under Apache Version 2.0. It supports MQTT versions 3.1, 3.1.1, and 5.0.
As the second broker wrote in Erlang/OTP, it borrowed some code from the EMQX project.
Unfortunately, this Plumtree cluster architecture has not proven to work, even though it
seems perfect in theory. The VerneMQ team and community have spent many years trying
to make it work, fixing problems such as network split, data inconsistency, and crash
recovery.
Finally, the project has stopped being actively developed and maintained, with only about
50 commits in the last 12 months.
Pros:
• High availability
• Horizontal scalability
• Message persistence
Cons:
• Limited documentation
Scalability
Yes (over 20
Clustering No No Yes
nodes cluster)
MQTT connections
4M 100k 100k 1M
per node
MQTT connections
100M N/A N/A ?
per cluster
Availability
Masterless
Clustering Yes No No Yes
Architecture
Latency
Less than 10
Single-digit Up to seconds Up to seconds
Latency (varies on milliseconds in
millisecond latency in some latency in some
different scenarios) most
latency at scale scenarios scenarios
scenarios
Reliability
In RocksDB and
Message
External In Files In SQLite In LevelDB
Persistence
Databases
Zero Downtime/Hot
Yes No No No
Upgrade
? here means that we were unable to find any publicly available documentation or
files that could serve as evidence regarding the item under discussion.
CoAP Yes No No No
LwM2M Yes No No No
Nanomsg/NNG No No Yes No
Username/Password
Yes Yes Yes Yes
Authentication
LDAP Authentication Yes Yes (via auth plugin) No Yes (via plugin)
Fine-grained Access
Yes Yes Yes Yes
Control
Dashboard Yes No No No
The MQTT broker serves as the backbone of your IoT communication infrastructure,
facilitating reliable and efficient messaging between devices and applications. Selecting
the right MQTT broker is of utmost importance for the success of your IoT business. An
unsuitable MQTT broker can lead to a range of challenges and limitations, such as
performance bottlenecks, unreliable message delivery, data integrity issues, or
compatibility problems with other components of your IoT ecosystem. Additionally,
migrating from one MQTT broker to another can be a complex and time-consuming
process. Therefore, investing time and effort into selecting the most suitable MQTT broker
from the outset can save you significant headaches and costs in the long run.
Whether you're a seasoned IoT professional or just starting your IoT journey, we believe
that the information provided here will assist you in choosing the right MQTT broker and
unlocking the full potential of your IoT projects. We wish you the best of luck in your MQTT
broker selection and future IoT endeavors!
popular brokers:
Try EMQX Enterprise for free to explore more advanced features Download Free
Get a tailored MQTT solution demo from our experts for your business Contact Us
EMQ is the world's leading software provider of open-source IoT data
infrastructure. We are dedicated to empowering future-proof IoT applications
through one-stop, cloud-native products that connect, move, process, and
integrate real-time IoT data—from edge to cloud to multi-cloud.
Our core product EMQX, the world's most scalable and reliable open-source
MQTT messaging platform, supports 100M concurrent IoT device connections per
cluster while maintaining 1M message per second throughput and
sub-millisecond latency. It boasts more than 20K+ enterprise users, connecting
100M+ IoT devices, and is trusted by over 400 customers in mission-critical IoT
scenarios, including well-known brands like HPE, VMware, Verifone, SAIC
Volkswagen and Ericsson.