Empowering Edge Computing with MQTT
Written by Ian Skerrett
Published: October 13, 2020
IoT is enabling every company to digitally transform their business to be more efficient, develop new business models and improve the customer experience. IoT devices are now becoming pervasive in all industries and are generating tremendous amounts of data. In fact, Gartner Group predicts by 2022, 75% of enterprise-generated data will be created by devices outside the traditional data center or cloud. The processing of this data is also moving out of the data centers towards the edge of the network, closer to the IoT devices that are generating this data. This is referred to as edge computing and is being adopted by companies to adapt to the new reality of IoT data processing.
MQTT has become the de facto protocol for transferring data between IoT devices and the cloud. This article looks at how MQTT can be used for transferring data between IoT devices, edge computing devices and the cloud.
Benefits of Edge Computing
Moving the processing of IoT data to edge computing enables IoT use cases that couldn’t exist if all the IoT data needed to be sent to the cloud. Edge computing also makes IoT applications more efficient and cost effective. Some of the common edge computing benefits include:
There are many IoT use cases that require sub-second response time to specific data events. For instance, for safety reasons a factory machine that needs to shut off if a human gets too close would require the processing of the human-too-close event to occur in sub-seconds. A delay to send the data to the cloud and wait for a response might be too long and result in harm to the person that is too close. Edge computing allows for the processing to occur closer to the machine and significantly reduces the latency times required for critical events.
Minimize bandwidth costs
IoT sensors can create a large amount of data that isn’t required for data processing. For instance, a temperature sensor generating a temperature reading every second only needs to transmit the data to the cloud when the data is outside of a specified range. Edge computing allows for the filtering of IoT data to reduce the amount of network traffic and minimize bandwidth costs.
Privacy and Security
Some IoT applications have specific data privacy and security considerations that edge computing can help address. For instance, a chemical factory might want to keep all the data within its facilities to ensure no outside interference in its operations. Edge computing in this case could be the equivalent of a mini-data center that can operate the factory without any communications with a corporate data center or cloud.
An automobile or an oil rig needs to be able to operate even during a network outage. Edge computing allows for autonomous operation for many IoT devices that operate over unreliable networks.
Different types of edge computing
There are different types of edge computing deployment models that depend on the use case and the compute capability of the edge device. In general the four types of edge computing are:
- Network Edge: Many telecom operators are offering the ability to run IoT applications within their network. This allows companies to deploy their applications close to the IoT devices to minimize latency. The compute capability at the network edge is equivalent to a public cloud provider or a data center.
- Compute Edge: Some organizations will deploy a mini data center into remote locations, for example factories and retail stores. These remote locations aggregate and process the local data from the IoT devices. The remote locations also connect to a corporate data center to consolidate data from different remote sites. The compute edge allows the remote locations to operate autonomously, provide enhanced privacy and security, reduced latency and reduce bandwidth costs.
- Device Edge: IoT Gateways and specialized devices, such as automobiles, robots, airplanes, etc. have the ability to aggregate and process data from the local sensors. These devices also have connectivity with a cloud provider or a corporate data center. The compute power in these types of devices typically have multiple CPUs but don’t have clustering capabilities.
- Sensor Edge: Many modern sensors have the ability to connect directly to the Internet. These sensors may have some limited compute capabilities to filter data.
MQTT and Edge ComputingMQTT has become the de facto protocol for connecting IoT devices to the cloud and corporate data centers. The publish/subscribe protocol is well suited for most IoT use cases and enables reliable and scalable data transfer. MQTT is the natural protocol to transfer data from edge devices to the cloud and transfer data within an edge device. How MQTT can be deployed to the edge will often depend on the type of edge computing.
MQTT on the Network Edge Deploying an MQTT broker to the network edge allows applications to have similar benefits as deploying a broker in the cloud or a data center. The MQTT broker is able to be deployed in a clustered environment and acts as the aggregation point for IoT data that is then forward to other enterprise IT services such as Kafka, MongoDB, SAP, etc. MQTT makes it possible for many of these services to interact with IoT devices in a scalable and reliable manner.
MQTT on the Compute Edge Deploying a broker to the compute edge will allow remote locations to process the MQTT messages locally. MQTT clients within the remote location are able to publish and subscribe to MQTT topics that are relevant to the client device. Compute Edge locations typically have the compute power to operate a clustered deployment of MQTT broker nodes.
It is often required that an MQTT broker deployed in the compte edge is able to forward messages to another broker in a corporate center. To accomplish this, MQTT supports the concepts of bridging between brokers. MQTT bridging is well suited for communicating between compute edge locations and a centralized broker. It is even possible to establish a mesh of MQTT brokers that allow remote locations to communicate directly with each other.
MQTT on the Device Edge IoT Gateways and specialized devices can deploy an MQTT client and/or an MQTT broker. Deploying an MQTT broker to the device edge allows the device to provide more autonomous data processing and coordination between the sensors on the edge device. For instance, an automobile could deploy a broker to coordinate the messaging between the different systems in a car.
The edge devices typically don’t have the compute power to support clustering. Therefore, the MQTT broker would be deployed as a single instance.
The device edge will need to transfer data to the cloud or data center. This can be accomplished by bridging the local MQTT broker with another broker in the cloud. The other model would be to deploy an MQTT client on the device edge to publish messages to a central broker.
MQTT on the Sensor Edge IoT sensors can be enabled to publish and subscribe messages through an MQTT client.
HiveMQ for Edge Computing
HiveMQ offers solutions for deploying MQTT to edge computing.
HiveMQ for the Network Edge
HiveMQ’s MQTT broker can be deployed on the network edge running on cluster environments, like Kubernetes, on virtual machines or on bare metal servers. The HiveMQ Bridge Extension makes it possible to connect remote MQTT brokers with the broker running on the network edge.
HiveMQ makes it possible for the MQTT broker to be deployed on the edge of the network to supply IoT data to enterprise IT services. HiveMQ allows for extensions to be deployed into the broker that tightly integrate the transfer of messages between enterprise services and IoT devices. For example, the HiveMQ Enterprise Extensions for Kafka allows for MQTT messages to be forwarded to a Kafka cluster and Kafka messages to be transposed into MQTT messages and published out to MQTT clients. Developers can create custom HiveMQ extensions that integrate MQTT messages with any enterprise IoT service.
HiveMQ for the Compute Edge
HiveMQ’s MQTT broker can be deployed on the compute edge located in remote locations. The HiveMQ Bridge extension makes it possible to connect remote brokers with each other and a broker in a central location. It is possible to set up a federation of brokers that are able to share data. HiveMQ can be deployed to a local cluster environment to support scalability and high availability.
The HiveMQ extension SDK can be used to integrate the MQTT messages with existing OT or IT systems. For instance, a HiveMQ extension can be developed that integrate MQTT messages coming from the factory floor into a local SCADA system.
HiveMQ for the Device Edge
HiveMQ’s MQTT broker or HiveMQ’s MQTT client can be deployed to an IoT gateway or IoT device. A single node HiveMQ broker can be used to coordinate MQTT messages between the sensors in the device. An MQTT client can aggregate the device sensor information and publish it to the broker.
HiveMQ for the Sensor Edge
HiveMQ MQTT client can be deployed on an IoT sensor to publish telemetry data and receive commands from a broker.
It is clear, that edge computing will become an important part of a company’s architecture for dealing with the rapid growth of data generation outside of the data center. MQTT has been successfully adopted for IoT devices since it is scalable and reliable. Edge computing will also benefit from MQTT for the same reasons. MQTT is the common protocol for transferring data from IoT devices and edge computing devices to the data center and the cloud.