What is MQTT, and Why Does it Matter?
February 26, 2018
In the world of Internet of Things (IoT) the main currency is messages. Even as you read this hundreds of thousands of devices are sending status reports, receiving orders (like “turn up the heat”, “measure the room humidity” etc.), storing data from other devices or doing numerous other tasks that make our lives easier. And they all need to exchange information, as without connectivity, their usefulness is immensely reduced.
But with the rapidly increasing number of devices that require Internet to communicate and be useful to individuals, businesses or governments, concerns like preserving bandwidth, ensuring that low-connectivity machines can also transmit data and even preserving battery life of gadgets need to be addressed. That is where MQTT comes in.
MQTT stands for Message Queuing Telemetry Transport or MQ Telemetry Transport. It is an open source machine-to-machine (M2M) messaging protocol that increasingly becoming the industry standard for IoT device communication. MQTT is a lightweight protocol, based on a publish/subscribe methodology that can be supported by even small devices in remote, low-connectivity destinations. Designed to breach the gap between the physical world gadgets (phones, sensors, wearables and etc.) with software processing technologies, this code is one of the main reasons for the expected 204.41% increase of IoT connected devices by 2025.
Initially, MQTT was developed as a proprietary software in 1999 by Andy Stanford-Clark (IBM) and Arlen Nipper (Arcom, now Cirrus Link). It was designed to carry information from remote oil pipelines through satellite connection and deliver it to the industrial data centers for analysis and storing. As you can imagine preserving both bandwidth and battery power were the two main concerns. Today, these two are still at the core of MQTT. However, it has become the main standard not only for Industrial Internet of Things (IIoT) but also for the smart gear we use in our everyday life.
So, to understand how MQTT works, you need to simply think about your favorite radio or TV channel. We have devices that publish to a broker on a specific topic. Then the broker sorts the data it receives from all publishers and organizes it into subjects. Clients subscribe to different channels and receive only the information about the specific topic they are programmed to listen for.
What Are the Main Benefits of MQTT for IoT?
Centralized System
As we mentioned the number of IoT devices increases rapidly. Just over a two-year period (from 2015 to 2018), it skyrocketed with over 50% increase. So, the need to manage the strain on bandwidth is tangible. Thanks to the broker device, the amount of data transmitted over the Internet can be limited. Thus, the subscriber is also relieved of the need for huge processors to handle the data.
Clear Message Hierarchy
With this much information flowing seamlessly between broker and devices, hierarchy is a must. That’s where MQTT shines with three different Quality of Service (QoS) levels. These define both the importance and the repetitiveness of a message within their environment. For example, QoS level 0 means that this is a one-time message, most likely a confirmation. It’s priority doesn’t warrant storage or a reply.
Information Flow Preservation
There are two ways for a MQTT session to be terminated. The first one is called a graceful shutdown. It happens when the publisher send a message to the clients, through the broker that it will disconnect. After a graceful shutdown, the client can later reconnect (subscribe to the same channel) easily by just providing its authentication tokens.
Should data transmission end unexpectedly, the broker has a pre-recorded (previously cached) message for all subscribers. Appropriately called “last will and testament”, it provides instructions for the clients on how to proceed if the publisher disconnects abruptly.
What Are the Main Challenges of Using MQTT?
Since MQTT was designed for a secure network where the data load was specific to a task at hand, its topic structure (the number of channels that a client can subscribe for) can grow exponentially. However, while the topic tree grows, there is not a clearly defined method to divide it into smaller, easily manageable chunks of logical data. The more information we put into the topic tree, the more it expands and becomes more and more complex. Thus, creating a scalable global MQTT network is still a difficult task.
Another issue that stems from the protocol’s original purpose is security. To provide a 21st-century level of security, MQTT needs to be used along with a mandatory SSL/TLS protocol that provides appropriate data encryption. However, SSL is by all means not a lightweight protocol. Moreover, all security features that are placed on top of MQTT not only inflate the code footprint but also put strain on bandwidth – the one thing MQTT is designed to relieve.
Why Is MQTT Important?
Despite of the issues that still leave some questions unanswered, it cannot be denied that the protocol is improving for the better. As developers all over the world work on solving security and data management issues, MQTT is already becoming the standard for Internet of Things communications. It provides many powerful benefits that cannot go unnoticed:
- Distributes information more efficiently
- Relieves strain and maximizes available bandwidth
- Improves scalability
- Reduces development time
From controlling your home environment remotely to using a messaging system like Facebook Messenger, MQTT is already part of your everyday life. And it will only become more common as technology evolves.
Source: http://kymerasystems.com/2018/02/07/what-is-mqtt-and-why-does-it-matter/