# Placement of IoT Microservices in Fog Computing Systems: A Comparison of Heuristics
## 4 Experimental Results  
### Experimental Setup  
In this section, we present a set of experiments aiming to assess the capability of the considered heuristics to find efficient solutions to the microservice placement problem in a fog infrastructure. To this end, we evaluate the effectiveness and efficiency of the previously proposed algorithms. In order to perform our analysis, we generate several random problems with predefined characteristics and evaluate the time required to achieve a solution together with the quality of the solutions found by the different heuristics. For this analysis, we relied on a virtualized system using XCP-NG as the hypervisor and running on an Intel Xeon Gold 6252 N CPU with a 2.30 GHz clock speed. The optimization algorithms were run on a VM with one vCPU and 8 GB of RAM (The presence of a single vCPU is not a problem for these algorithms, as they are not inherently parallel). Figure 1 presents an example of a problem along with its deployment. The data flows in the logical organization of the services are represented by solid lines. The data flows from sensors to services are depicted in blue and the data exchanged by chained microservices in a service chain in black. The mapping of logical elements over the infrastructure is represented in dashed lines: yellow for links from sensors to the fog nodes and red for the deployment of services over the fog nodes. Each problem is defined in terms of the following:  
* Service chain length \(L_{c}\), that is, the number of microservices composing a chain;
* The service time of a service chain \(S_{c}\);
* The average network delay \(\delta\) between two fog nodes;
* Overall infrastructure load \(\rho\);
* The problem size, that is, the number of fog nodes and service chains considered. Throughout this analysis, as an efficiency metric we consider the time required to solve a problem; the quality of the solution is represented by several metrics. The most straightforward metric is the the response time of the service chains. However, to provide a deeper understanding of the solution, we additionally consider the average number of hops in the chain deployments normalized against the chain length (with a range of \([0,1]\)). Another critical performance metric of interest is the Jain index, a fairness measure that quantifies the ability of the genetic algorithm to achieve load balancing over the fog infrastructure. The Jain index is defined as \(J=1/(1+\text{CoV}(\rho_{f})^{2})\), where \(\rho_{f}\) is the  
Figure 1: Example of the generated problem. utilization of each node \(f\in\mathcal{F}\) and \(\text{CoV}(\cdot)\) is the coefficient of variation, i.e., the ratio between standard deviation and mean, computed over all fog nodes. An index of 1 means perfect balancing, while a lower value means that the load is unevenly distributed among the fog nodes. In this analysis, we consider chains of equal length, that is, \(L_{c}=|\{m\in c\}|\) is constant \(\forall c\in\mathcal{C}\). The impact of this parameter is evaluated in Section 4.4. In the other analyses, we consider chains composed of five microservices. The overall system load is defined as  
\[\rho=\sum_{c}\lambda_{c}L_{c}\cdot\frac{\sum_{c}S_{c}}{\sum_{f}P_{f}}, \tag{12}\]  
which means that the loads have ranges in the interval \(\rho\in[0,1]\). The impact of this parameter is studied in Section 4.3. In the other analyses we fix \(\rho=0.6\), which corresponds to medium utilization of the infrastructure. Concerning the problem size and according to the notation introduced in Table 1, the number of nodes can be identified as \(|\mathcal{F}|\), while the number of chains is \(|\mathcal{C}|\). As default values used unless otherwise specified, we consider a set of ten fog nodes supporting four service chains. For this analysis, we assume that the SLA is set to \(10\times\) the service time of the chain, which is a common value used in cloud applications; i.e., in Equation (6), we consider \(K=10\).