MQTT — The artery of IoT

Vinay Kashyap
Engineering @ Akiro
5 min readJun 6, 2021

It is only when they go wrong that machines remind you how powerful they are ” — Clive James

MQTT and the Internet of Things

We all know that Machines were invented to augment our comfort and convenience. We have now realised that the same machines when connected with each other, takes it to the next level.

The Internet of Things, or IoT in simple terms refers to the billions of machines or devices connected with each other over the internet. Today, we see connected devices in the field of Consumer Electronics, Smart Infrastructure, Mobility, Manufacturing Industries, Healthcare and so on making the IoT a ubiquitous entity.

Connectivity plays a crucial role in the world of IoT, where data from the devices are continuously extracted, analysed and presented to drive our standard of living and businesses. The Telemetry data from each device, even though seem small as individual packets, become massive when aggregated. Thus, there is a need for a powerful technique to support the continuous handling of the telemetry data from and across devices.

Possible Options

There are a bunch of techniques or protocols to exchange data from and across devices. Some primary ones are

Advanced Message Queueing Protocol (AMQP) — An open source messaging protocol for middleware that supports both point to point and publish-subscribe. Though highly reliable with a rich feature set, it is resource intensive for IoT applications.

Extensible Messaging and Presence Protocol (XMPP) — An XML based open communication protocol predominantly used for instant messaging enabling near real time exchange of structural data. The main disadvantage of XMPP is the redundancy where more than half of the transmitted data is the presence information eating up the network traffic.

Hypertext Transfer Protocol (HTTP) — One of the most widely used messaging protocols, based on client-server model, ruling the data exchange on the Web. Despite its wide acceptance on the Web, it has its limitations when it comes to IoT. HTTP is synchronous and one to one. Each message is a typical request and response with a lot of header information to make it bulky.

MQTT

Message Queue Telemetry Transport is a publish-subscribe messaging protocol which resides on top of TCP/IP stack and is extremely lightweight, reliable and is designed to work in a low bandwidth, high latency and unreliable environments. MQTT’s feature set makes it a pertinent choice for exchanging messages across devices. It has become the de facto standard for IoT applications.

Brief History

MQTT was invented in the late 1990s by Andy Stanford-Clark and Arlen Nipper to monitor the pipelines in SCADA (Supervisory Control and Data Acquisition) in the Oil and Gas industry where there was a need for lightweight and quality service guarantee. Later in 2014, it was submitted and released as an OASIS standard and today we have multiple implementations and support in most of the popular programming languages.

Architecture

MQTT works with a Publish-Subscribe model, where the publisher and subscriber are loosely coupled unlike the traditional Client-Server model. The Publisher and the Subscribers do not have a direct physical connection and the messages are routed via a Broker.

MQTT — Architecture

Broker

A message Broker is a server which routes the message traffic from a sender to one or more receivers. The Broker maintains all the metadata required to keep the devices connected and exchange messages.

Topic

A Topic is an indirect channel between the publishers and the subscribers. It is a logical entity which represents the destination of a message. The receiving entities register or subscribe themselves with the Broker that they are interested to listen to this channel. When a sender sends a message to the Topic, the Broker directs it to the respective interested subscribers. Topics are name-spaced strings which are forward slash (‘/’) separated and is a mandatory attribute of any message to be exchanged.

For eg : To extract the brightness information from a Smart Bulb, the topic can be /home1/floor1/room1/bulb1/brightness

The X Factors

To understand the reason why MQTT is the best fit for IoT applications, we need to explore some of the most important characteristics.

Light Weight

MQTT is a resource efficient protocol where each message is very small and consumes very less bandwidth compared to other protocols. It is designed in such a way that the clients can be run even on a microcontroller.

Secure

Runs on top of TCP/IP stack, MQTT supports the SSL/TLS encryption methodology. It also supports pluggable Authentication and Authorization mechanisms for the Clients.

Bi-directional

With a persistent connection with the Broker, the Clients are entitled to have a Bi-directional channel to and from the Topic. This ensures continuous data exchange capabilities.

Reliable

MQTT ensures reliable message exchange using the Quality of Service (QoS) specification. There are 3 types of QoS definitions.

0 — At most Once

1 — At least Once

2 — Exactly Once

( MQTT comes with an exhaustive list of features and discussing them in detail is beyond the scope of this write up)

Final Thoughts

In today’s world of the IoT, we see connected devices around us. Smartphones, Wearables or Fitness devices from the Consumer Electronics, or Connected and Self Driving Vehicles from Telematics and Mobility, Home Automation and Smart Offices from Smart Infrastructure segment and many more to quote where the devices exchange data in real time and stay connected driving number of critical aspects of life and business. The very nature of MQTT, being an asynchronous protocol, decouples the sender and the receiver in terms of both storage and time. It keeps the message extremely light weight and ensures real time message transfer making it more efficient for mission critical systems. Thus MQTT becomes an excellent choice to unleash the power of connectivity across devices.

Akiro is one of the MQTT Brokers for High Performance Messaging and Connectivity, designed to cater to IoT use cases and proven to handle 10s of millions of concurrent connections and message exchange. Akiro’s Smart Ingestion enables multi-protocol support thereby providing a real time experience to the downstream systems.

Akiro’s Smart Ingestion brings multi-protocol support serving multiple verticals

The platform is also equipped with an event processing engine to evaluate rules and receive instant alerts and notifications. The analytics capabilities of Akiro provides rich actionable insights to improve the business efficiency. Sign up for a trial version to try our MQTT Broker for free.

--

--

Vinay Kashyap
Engineering @ Akiro

Architect | High Performance Messaging and Connectivity | IoT Platform