# Efficient Data Delivery Scheme for Large-Scale Microservices in Distributed Cloud Environment
## 3 Communication Model for Microservices-Based IoT Applications
### Edge-Cloud Pub/Sub Brokers Model for Microservices-Based IoT Applications  
Figure 1 shows the hierarchical Edge-Cloud publish/subscribe system to support collaboration and data exchange among microservices in IoT applications at scale. In the model, the IoT applications are composed of microservices that can be deployed at the IoT devices, IoT gateways, Edge Cloud, and Core Cloud to provide specific IoT functionalities of business logic. The pub/sub system is the common tool for the microservices to interact and collaborate through events. The cloud-based microservices and the cloud pub/sub brokers can be deployed on major cloud provider frameworks such as AWS, Azure, and Google Cloud to take advantage of their high scalability, high availability, and various flexible options.  
The model plays as an event-based middleware, which provides a powerful interprocess communication (IPC) tool for microservices-based IoT applications. With pub/sub client modules provided, microservices in IoT devices can collaborate and exchange data with each other with flexibility and efficiency. Communication channels or data that need to be exchanged or transferred among the services are structured as a set of topic channels in the model. In addition, the microservices can be either producers/publishers or consumers/subscribers of related events generated in the topic channels of the pub/sub system. Multiple services can publish events for a topic/event channel, and a service can subscribe to multiple topic/event channels of interest to it. These are referred to as pub/sub clients in this system. Strategically placed pub/sub brokers in the Edge/Cloud levels establish communication between the pub/sub clients. Each topic/event channel publisher gathers pertinent information or the producer states and transmits them to their pub/sub brokers. The subscribers communicate their interests to the responsible brokers by subscribing to relevant topic/event channels to obtain relevant notifications. The event notifications are then propagated asynchronously from the sending microservices (producers) to the receiving microservices (consumers).  
Services, including IoT data aggregation and validation, real-time data processing, and local data storage, are supported by the pub/sub brokers in the Edge-Cloud layer of the model. Data collected or generated by specialized services from IoT devices are gathered and aggregated at IoT gateways or Edge brokers for preprocessing and appropriately instructing the devices to react accordingly. Hence, computation, message, and storage services can be offered to IoT applications with low latency and modest bandwidth consumption. A new technique was devised to organize the edge brokers into proper clusters to reduce data delivery delay further. Furthermore, a cloud-based pub/sub broker infrastructure was implemented to facilitate communication between the various edge broker nodes. In addition to providing services for aggregating data filtered by edge brokers, cloud brokers collect data for deep analytics or long-term storage in the Core Cloud, from which additional valuable insights can be extracted. The coordination part of the TBPS system keeps tabs on each broker topic channel data, helping to ensure that all pub/sub brokers are properly linked and delivering data as quickly as possible.  
Figure 1: Hierarchical Pub/Sub system for microservices-based IoT applications.