Citation: Manzoni, P.; Maniezzo, V.; Boschetti, M.A. Modeling Distributed MQTT Systems Using Multicommodity Flow Analysis. Electronics 2022, 11, 1498. https:// doi.org/10.3390/electronics11091498 Academic Editors: Nurul I. Sarkar and Juan-Carlos Cano Received: 9 April 2022 Accepted: 30 April 2022 Published: 7 May 2022 Publisher’s Note: MDPI stays neutral with regard to jurisdictional claims in published maps and institutional affil- iations. Copyright: © 2022 by the authors. Licensee MDPI, Basel, Switzerland. This article is an open access article distributed under the terms and conditions of the Creative Commons Attribution (CC BY) license (https:// creativecommons.org/licenses/by/ 4.0/). electronics Article Modeling Distributed MQTT Systems Using Multicommodity Flow Analysis Pietro Manzoni 1, * , Vittorio Maniezzo 2 and Marco A. Boschetti 3 1 Department of Computer Engineering, Universitat Politècnica de València, 46022 Valencia, Spain 2 Department of Computer Science and Engineering, University of Bologna, 47521 Cesena, Italy; vittorio.maniezzo@unibo.it 3 Department of Mathematics, University of Bologna, 40126 Bologna, Italy; marco.boschetti@unibo.it * Correspondence: pmanzoni@disca.upv.es Abstract: The development of technologies that exploit the Internet of Things (IoT) paradigm has led to the increasingly widespread use of networks formed by different devices scattered throughout the territory. The Publish/Subscribe paradigm is one of the most used communication paradigms for applications of this type. However, adopting these systems due to their centralized structure also leads to the emergence of various problems and limitations. For example, the broker is typically the single point of failure of the system: no communication is possible if the broker is unavailable. Moreover, they may not scale well considering the massive numbers of IoT devices forecasted in the future. Finally, a network architecture with a single central broker is partially at odds with the edge-oriented approach. This work focuses on the development of an adaptive topology control approach, able to find the most efficient network configuration maximizing the number of connections and reduce the waste of resources within it, starting from the definition of the devices and the connections between them present in the system. To reach the goal, we leverage an integer linear programming mathematical formulation, providing the basis to solve and optimize the problem of network configuration in contexts where the resources available to the devices are limited. Keywords: publish/subscribe; Internet of Things; integer linear programming 1. Introduction The Internet of Things (IoT) is a global network of connected devices, people, and processes, all of which collect and share data about how they are used and the environment around them. A timely analysis of the data coming from the IoT infrastructure is crucial in transforming it into knowledge that can add value to the application domain. The information generated by IoT devices is typically sent to servers hosted in the cloud that can be far away. Li et al. [1] showed that the average round-trip time from various geographically distributed points to their optimal Amazon EC2 instances is 74 ms. To this transfer time, we should add the latency of the first wireless hop and the possible temporary connection failures, another major problem that interferes with developing critical applications or applications with real-time requirements. In [2], Bonomi et al. proposed the term “fog computing”, which consists of a multilevel hierarchy of nodes spanning from the cloud to IoT devices. Edge or fog computing allows bringing AI-based IoT solutions in areas where connectivity is scarce and, in general, resources are limited, for example, in rural or remote areas. Consider, for example, the so-called TinyML solutions [3], a fast-growing field of machine learning technologies capable of performing on-device data analytics at extremely low power, typically in the mW range. Therefore, a transition from a centralized, cloud-based architecture to an interoperable and decentralized dynamic IoT architecture looks promising. This transition will allow achieving highly efficient and responsive services by locating the data processing close to the data source, in the edge. However, current IoT infrastructures are not ready for Electronics 2022, 11, 1498. https://doi.org/10.3390/electronics11091498 https://www.mdpi.com/journal/electronics