As referred before, the objective of this work is to allow the specification of real-time communication requirements for time-sensitive (TS) MQTT flows while preserving compatibility with the MQTT standard. This is achieved by resorting to the
User Properties, available in MQTT V5.0 specification [
9] to convey the real-time requirements of a given TS topic. This information is decoded by a Network Manager that then reserves appropriate communication channels for such flows. In this paper, we adopt SDN/Openflow to develop such a Network Manager and enforce network reservations, but potentially any other networking technology able to provide bandwidth reservations and traffic prioritization could be used, e.g., IEEE TSN [
31] or HaRTES [
32].
4.1. System Architecture
Figure 1 shows the proposed Real-Time MQTT (RT-MQTT) system architecture, including a set of OpenFlow switches (OF-Switches) connected to a central OpenFlow controller (OF-Controller), (I)IoT devices as MQTT clients, and an MQTT broker. Additionally, the system also includes a Real-Time Network Manager (RT-NM), which is logically placed between MQTT clients and the broker. The real-time requirements of all TS flows are kept in the OF-DataBase (OF-DB). Currently, the OF-Controller is based on the RYU framework [
33] and the OF-Switches are instantiations of the
Open vSwitch soft switch.
The RT-NM inspects all MQTT messages directed to the broker. When such messages convey real-time reservations, coded in the User Properties field, it registers the corresponding attributes, processes them, and updates the OF-DB in the OF-Controller. In turn, the OF-Controller updates the flow tables of the OF-Switches, creating real-time channels that match the specified real-time requirements.
4.2. Reservation Mechanism
As specified by the OpenFlow protocol, the OF-Controller is connected to all OF-Switches and holds a global view of the network. More specifically, the OF-Controller can collect detailed topological information, identifying all OF-Switches, ports, and links between them. In addition, OF-Switches are configured to send to the OF-Controller packets that do not match any installed flow rule via the so-called PacketIn messages. When the OF-Controller receives one of these messages, it checks the header fields of the corresponding incoming packet, getting information such as the source and destination IP address and the switch port at which it was originally received. Therefore the OF-Controller keeps a holistic network view that is then used for routing purposes.
The routing scheme adopted in this work is based on the Depth-First Search algorithm [
34], with the link cost set as a weighted function of transmission delay and maximum available bandwidth of each possible path between source and destination nodes. The routing procedure is out of the scope of this paper and further details can be found in [
35].
In general, it is not possible to find exclusive paths for each TS MQTT flow; therefore, these packets may share links with non-TS MQTT flows and other generic data sources. Consequently, without specific mechanisms, the potentially non-deterministic nature of other data sources would compromise the timeliness of TS MQTT flows. To address this problem, MQTT clients (both publishers and subscribers) associated with each time-sensitive flow communicate the corresponding real-time requirements via the MQTT
User Properties field. RT-MQTT adopts the following subset of attributes, commonly used in real-time systems:
where:
- i:
flow identifier;
- :
flow priority;
- :
period or minimum inter-arrival time between two successive publish messages (by the publisher);
- :
deadline, defined as the maximum allowed amount of time between the transmission (publisher to broker) and the reception (broker to subscriber) of a message;
- :
maximum link bandwidth use;
- :
maximum message payload size;
The RT-NM module intercepts all messages exchanged between the MQTT Broker and clients, extracting, when present, the real-time requirements associated with each flow (
), which are then stored in a system’s real-time requirements table (SRT) that resides on the OF-DB. This table also holds the addresses of publishers and subscribers, which are obtained by the RT-NM module from the standard MQTT messages exchanged between the broker and clients during the connection set-up phase. More formally, the SRT is defined as follows:
where:
- i:
flow identifier;
- :
address of publisher node;
- {}:
set of k subscriber nodes addresses.
The information contained in the SRT, in conjunction with the topology information obtained by the OF-Controller, is then used to configure the real-time channels of all links in the path between the publisher and the Broker and between the Broker and the subscriber(s).
Note that this basic architecture can be complemented, if necessary, with control services. For example, changing the real-time attributes of a given flow can be restricted to a subset of (trusted) nodes, ignoring requests that originated elsewhere. Similarly, allocating resources to each flow can be constrained to (pre)defined bounds. These topics are out of the scope of this paper and will be addressed in future work.
The message format used in RT-MQTT follows the MQTT V5.0 message structure, in which the
User Properties field is placed in the Variable Header and conveys the relevant real-time attributes, as illustrated in
Figure 2.
The core functionality of the real-time extensions is handled by the RT-NM. This module intercepts all messages from the MQTT clients to the broker, thus gathering the real-time attributes of time-sensitive traffic. As illustrated in
Figure 3, when the RT-NM receives an MQTT client message, it inspects its content to determine the presence of a real-time reservation request, and, if one is found, the relevant real-time information is extracted and inserted into the OF-DB.
The interface between the RT-NM and the OF-DB is carried out using the OVSDB management protocol (OVSDB-MP) [
36], as sketched in
Figure 4.
Whenever the OF-DB is updated, the ovs-vswitchd daemon, which manages and controls the Open vSwitch switches, retrieves the real-time information. Then, in cooperation with the OF-Controller, it analyzes the set of registered real-time attributes to update the OF-Switch flow tables and set up the data paths. The ovs-vswitchd daemon also communicates with the kernel module of the corresponding node over netLink, a Linux kernel interface, to execute the associated actions corresponding to each received packet.
The real-time information can be modified at any time by MQTT clients, which can register or update real-time attributes of any given topic in the OF-DB. These attributes can be set initially, during the connection phase, using the CONNECT message, or added/updated later on, e.g., when a client publishes data via a PUBLISH message. In the same way, subscribers can specify real-time requirements when connecting or when subscribing to a topic using a SUBSCRIBE message.
Figure 5 shows the sequence diagram for connecting, publishing, and subscribing. Note the RT-NM receives the messages, validates their attributes, and performs the corresponding network configuration, while the broker eventually sends an acknowledgment back to the client. A technical description of RT-MQTT services is publicly available (
https://new-rt-mqtt-extension-api.readthedocs.io/en/latest/, accessed on 31 January 2022).