<figure><img src="image_1.png" /></figure>

HAL
open science

Application of Ant Colony Optimization in Cloud
Computing Load Balancing

Zheng-Tao Wu

<figure><img src="image_2.png" /></figure>

To cite this version:

Zheng-Tao Wu. Application of Ant Colony Optimization in Cloud Computing Load Balancing. 2nd International Conference on Intelligence Science (ICIS), Oct 2017, Shanghai, China. pp.400-408, 10.1007/978-3-319-68121-4_43 . hal-01820900

HAL Id: hal-01820900

https://inria.hal.science/hal-01820900

Submitted on 22 Jun 2018

**HAL** is a multi-disciplinary open access
archive for the deposit and dissemination of sci-
entific research documents, whether they are pub-
lished or not. The documents may come from
teaching and research institutions in France or
abroad, or from public or private research centers.

L'archive ouverte pluridisciplinaire HAL, est
destinée au dépôt et à la diffusion de documents
scientifiques de niveau recherche, publiés ou non,
émanant des établissements d'enseignement et de
recherche français ou étrangers, des laboratoires
publics ou privés.

<figure><img src="image_3.png" /></figure>

Distributed under a Creative Commons Attribution 4.0 International License
Application of Ant Colony Optimization in Cloud
Computing Load Balancing

Wu Zheng-tao

School of information engineering, Shanghai Maritime University, Shanghai, China, 201306

**Abstract.** In cloud computing, because all the tasks are submitted and requested by the users, it is the key to improve the quality of service whether all tasks are scheduled to every host to achieve the shortest completion time for all tasks. In this paper, the basic ant colony algorithm is modified appropriately to enable task scheduling and load balancing. The simulation results show that the ant colony algorithm can effectively obtain the global optimal solution and realize the shortest task completion time.

**Keywords:** cloud computing; load balance; Ant Colony Optimization

# 0 Introduction

Cloud computing is a new business and computing model which is proposed in recent years. Thousands of hosts are linked together over the network to form an ultra large pool of resources. Google corporation is the first to use cloud computing service, its scale has reached millions of machines, and other companies such as Microsoft, Amazon, Aliyun and so on, also reached the scale of several hundred thousand units[1]. Depending on the type of service, cloud computing is divided into three layers, namely, IaaS (infrastructure as a service), PaaS (platform as a service), and SaaS (software as a service). No matter which layer, there is the need to balance the task of scheduling to the host, that is, load balancing. However, due to the large number of computers in the cloud computing platform, the complexity of the structure and the difference of the allocation of resources, it is difficult to achieve load balancing for such large-scale, heterogeneous and non-centralized task scheduling. The unbalanced load will lead to the decrease of system efficiency and throughput, and the instability of the daily operation, which will seriously affect the quality of service of cloud computing[2].

Ant Colony Optimization (ACO) is a kind of bionic intelligent algorithm to find the optimal solution, simulating the foraging behavior of ants. The wisdom of a single ant is not high, but it achieves an optimal population effect by sharing information among groups. Ant colony algorithm is a kind of positive feedback algorithm, which has good robustness and adaptability, and is easy to combine with other algorithms[3]. Therefore, ant colony algorithm can be used in load balancing.

The ant colony system was firstly proposed by Italy scholars Dorigo, Maniezzo and others in 1990s. When they studied ants foraging, they found that the behavior of a single ant was relatively simple, but the whole ant colony could show some intelligent
behavior. For example, an ant colony can find the shortest path to a food source in different environments. This is because ants in the ant colony can transfer information through some kind of information mechanism. Further studies have shown that ants release a substance called "pheromones" on their path.

The ants in the colony can apperceive pheromones, they will follow the path with high concentration pheromone, and every ant will leave the pheromones on the road, which forms a kind of positive feedback mechanism. Thus, after a period of time, the whole ant colony will arrive at the food source along the shortest path.

The basic idea of applying ant colony algorithm to solve the optimization problem is to use the path of the ant to represent the feasible solution of the problem to be optimized. All the paths of the whole ant colony form the solution space of the optimization problem. The shorter path ants release more pheromones, and as time goes on, the pheromone concentration on the shorter path increases gradually, and the number of ants in the path is increasing. Finally, the whole ant will concentrate on the best path under the positive feedback. At this time, the corresponding solution is the optimal solution of the problem to be optimized.

Researchers based on the study of ACO use traveling salesman problem as a test of performance, not others. In this paper, the basic ACO is modified accordingly, using cloudsim platform as simulation experiment, and design, modify the corresponding parameters, in order to design a load balancing algorithm.

# 1 Mathematic Model of Task scheduled

ACO is a new bionic intelligent algorithm. The first ant guides and influences the selection of the following ants by means of pheromone, so as to achieve the goal of cooperation among ants. The application of ant colony algorithm in the task scheduling of cloud computing is studied in this paper.

In a data center of cloud computing, there are n virtual hosts, they are set as $Vm_1, Vm_2, Vm_3, \dots, Vm_n$. Each virtual host has a different MIPS (millions of instructions per second). At the same time, there are m tasks that need to be scheduled to work on the n virtual hosts. The total amount of time spent in these tasks is:

$$T_{total} = \max(T_1, T_2, \dots, T_n) \qquad (1)$$

Where $T_i$ indicates that the i virtual host completes the time allocated to all of its tasks, calculated by formula (2) and formula (3).

$$t_j = \frac{MI_j}{MIPS} \qquad (2)$$

$$T_i = \sum_{j=1}^{k} t_j \qquad (3)$$

In the above two formulas, suppose that the performance of platform I virtual host is MIPS, and there are k tasks allocated on it, the number of instructions corresponding to each task is $MI_j$(Million Instructions), so the time for each task is $t_j$.
# 2 Ant Colony Optimization

## 2.1 Theory of Ant Colony Optimization

After finding the food, the ants will randomly explore the way from home to food, and leave on the road with pheromones that are inversely proportional to the length of the journey. Subsequent ants will be based on the concentration of pheromones, select the nearest road, so as to achieve the group to find the best path of the results. If the shortest path is interrupted, the ants will randomly explore and converge quickly to the new shortest path.

The basic ACO in the TSP (traveling salesman problem) on the state as follows: at time 0, all the ants and n city will initialize m ants randomly in a city as a starting point, each edge between the city has an initial pheromone concentration $τ_{ij}(0)$, Each ant places its city as the first element of the tabu list. Each ant then selects the next city to move, based on the probability function of the two parameter($α, β$) (formula (6)), moving from the city I to the city J, and fill out the corresponding tabu list. After a cycle of N times, all ants go through all the cities and fill out the tabu list. After that, calculate the path length of each ant $L_k$, and then update corresponding pheromone $Δτ_{ij}^k$ according the formula (4). Save the shortest path that ants walk through, and get the shortest path $minL_k$ after one traversal, And empty all the tabu tables and start the next traversal loop. Repeat the process until the number of iterations reaches the required number of iterations($N_c$), get the shortest path $minN_c$ in the global situation.

$$τ_{ij}(t + 1) = ρτ_{ij}(t) + \sum Δτ_{ij}^k \quad (4)$$

where $τ_{ij}(t + 1)$ is the updated pheromone concentration, $ρ$ is the rate of pheromone emission, $Σ Δτ_{ij}^k$ is the sum of pheromones left by all ants.

$$Δτ_{ij}^k = \begin{cases} \frac{Q}{L_k} & \text{through the road} \\ 0 & \text{not through the road} \end{cases} \quad (5)$$

where Q is a constant, $L_k$ is the path length of ants.

The probability function of the first k ant moving from city I to city J is:

$$p_{ij}^k = \begin{cases} \frac{(τ_{ij})^α (η_{ij})^β}{\sum_k (τ_{ij})^α (η_{ij})^β}, & j \in J(i) \\ 0, & \text{other} \end{cases} \quad (6)$$

where $J(i)$ means In the tabu list of K, the J city has not passed yet.

In summary, fig.1 shows the flow chart using ACO to solve the TSP problem.
<figure><img src="image_4.png" /><figcaption>Fig.1.ACO solve TSP problem</figcaption></figure>

## 2.2 Realization of Ant Colony Optimization

In the solution of the shortest time, m ants were placed in the initial position, according to the rules of a certain probability choice, every ant can arrange Vm for next task, until all tasks completed, and then pheromone increment table will be updated based on the total time. After all ants have finished their work, the best solution is selected from all candidate allocation and the historical optimal solution, and it is recorded, then the homologous pheromone table is updated. Then the pheromone is corrected, simulating the ants releasing pheromone on the optimal path and the natural volatilization of pheromone, leading the ant to find the global optimal solution. Fig.2 shows the flow chart of the algorithm implementation.
<figure><img src="image_5.png" /><figcaption>Fig.2 the flow chart of the algorithm implementation</figcaption></figure>

(1) calculation rules of pheromone increment table

After each walk, each ant leaves a certain amount of pheromones according to the length of the path. The more ants there are in the same path, the more pheromones they leave behind at the same time. The pheromone increment table records the size of the pheromone emitted by the ants after each cycle. In this paper, the pheromone increment with $\Delta_{ij}^k$, $\Delta_{ij}^k$ calculation rules such as formula (7) for:

$$ \Delta_{ij}^k = \begin{cases} \frac{Q}{L}, & j \in Vm_i \\ 0, & j \notin Vm_i \end{cases} \qquad (7) $$

In the formula, Q is expressed as a constant, and L is the total time after which the current ant is assigned the task. Each ant will leave pheromones on its path, and in the end, the global pheromone increment is the sum of the pheromone left by all the ants.

(2) calculation rule of task transfer probability

When the ant chooses the virtual host for the next task, it is determined by the pheromone left before it and a heuristic information. The probability formula for
assigning the task J to the virtual host I is shown in formula (6), where $τ_{ij}$ is pheromone concentration, $η_{ij}$ is the heuristic information. The formula of $η_{ij}$ is given by formula (8) and (9):

$$η_{ij} = \frac{1}{D_{ij}} \qquad (8)$$

$$D_{ij} = \frac{Task_i}{MIPS_i} + \frac{L_j}{BW_i} \qquad (9)$$

Where $Task_i$ represents the total number of tasks allocated on table I Vm, $MIPS_i$ is the execution speed of the CPU for this Vm, $L_j$ is the length of the task to be assigned, and $BW_i$ is the interface bandwidth of this Vm, which is a constant in this paper. $α, β$ are control parameters that control the relative importance of pheromone and heuristic information.

### (3) Amendment rules for pheromone tables

When all ants completing one iteration and getting an optimal solution, pheromone table is needed to have a comprehensive revision according to the pheromone emitted by ants and the phenomenon that simulates the natural evaporation of residual pheromones, the correction rule is such as formula (10):

$$τ_{ij}(t + 1) = (1 - ρ)τ_{ij}(t) + \sum_k \Delta_{ij}^k \qquad (10)$$

Where $τ_{ij}(t + 1)$ is the pheromone table after correction, $τ_{ij}(t)$ is pheromone table before correction, $ρ$ is the control parameter, indicates the degree of evaporation of pheromones, $\sum_k \Delta_{ij}^k$ is the sum of pheromone increments left by all ants. The purpose of pheromone correction is to assign as many pheromones as possible to the optimal allocation mode, and better guide the selection of ants. The rule will not only store the pheromones left by the ants, but will also evaporate them properly.

## 2.3 Algorithm parameter design

According to the above principle and various rules, this paper has designed and stipulated a series of parameters. In the formula (7), the value of the constant Q will affect the left ant pheromone on global pheromone influence, it will weaken the influence of a better path on later ants if Q is too small, otherwise it will faster convergence which can easily fall into local optimal solution. According to the task length and the MIPS value of Vm, repeated experiments were conducted, and finally 100 was selected. In the formula (6) and (10), $α, β, ρ$ are control parameter, where $α, β$ respectively indicate the importance of pheromone and heuristic information, and $ρ$ is the volatilization rate of pheromones. Studies have shown that when $α$ is 1, the resulting optimum is better than the other. When value of $β$ is from 1 to 5, the optimal solution quality will gradually become better, and when $β$ is more than 5, the quality of the solution can be reduced, therefore, 5 is assigned to $β$. P value changes between 0.3~0.9, the solution changed little, when its value is 0.5, the quality of solution is the best, $ρ$ is suggested to value of 0.5[5]. In formula (9), MIPS is randomly chosen in 100~300, and BW is the interface bandwidth. In this paper, the default value of simulation software is taken. The task length of all tasks is also random, with a range
of 10000~50000.

# 3 Simulation and results

This paper uses cloudsim3.0 simulation platform to do simulation experiments. By inheriting the DatacenterBroker class, we extend the DatacenterBrokerACO class to ACO, and compile the Ant class and ACO class. We can regulate single ant activity and ant colony activity separately.

## 3.1 Introduction of cloudsim

Cloudsim is a cloud computing simulation platform developed by Melbourne University in Australia on the basis of Gridsim. CloudSim has several versions, and has now grown to version 3 of CloudSim. CloudSim 3 uses a layered architecture. Simulation layer provide a support for the configuration and simulation of virtual data center environment simulation for cloud computing, including virtual machines, memory, capacity, and bandwidth interface. This layer is used to study strategy of virtual machine to the host distribution, and the implementation of virtual machine scheduling function expansion core. The top layer is the user code layer, which provides basic entities such as hosts, applications, virtual machines, user data and application types, and agent scheduling policies. CloudSim 3 provides virtualization engines that build and manage multiple virtualized tasks on data center nodes and flexibly switch between time sharing and spatial sharing policies when virtualized services are allocated. Cloudsim 3 is open source, users can expand the open source code by expanding the interface, realizing their own scheduling strategy, and test and verify the corresponding function based on specific environment and configuration.

## 3.2 Result of Simulation

Before the simulation starts, the paper specifies some parameters in the ant colony algorithm, as shown in table 1:

<table><caption>Table.1. parameters of ACO</caption><thead><tr><th>Q</th><th>α</th><th>β</th><th>ρ</th></tr></thead><tbody><tr><td>100</td><td>1.0</td><td>5.0</td><td>0.5</td></tr></tbody></table>

In order to ensure the heterogeneity of all virtual hosts, Java is used to randomly specify 20 different MIPS hosts. The range of MIPS is 100~300, and the value of MIPS is shown in table 2:

<table><caption>Table.2.the MIPS of 20 Vm</caption><thead><tr><th>VmId</th><th>1</th><th>2</th><th>3</th><th>4</th><th>5</th></tr></thead><tbody><tr><th>Mips</th><td>228</td><td>299</td><td>108</td><td>204</td><td>152</td></tr></tbody></table>
<table><tr><td>VmId</td><td>6</td><td>7</td><td>8</td><td>9</td><td>10</td></tr><tr><td>Mips</td><td>275</td><td>202</td><td>278</td><td>109</td><td>195</td></tr><tr><td>VmId</td><td>11</td><td>12</td><td>13</td><td>14</td><td>15</td></tr><tr><td>Mips</td><td>208</td><td>294</td><td>196</td><td>143</td><td>140</td></tr><tr><td>VmId</td><td>16</td><td>17</td><td>18</td><td>19</td><td>20</td></tr><tr><td>Mips</td><td>209</td><td>292</td><td>194</td><td>212</td><td>255</td></tr></table>

At the same time, 100 tasks with different task lengths are generated randomly, and the length is 10000~50000.

In order to determine the optimal solution, the number of ants is taken as half of the number of virtual hosts, 1000 iterations, and the final total running time is 813.1402877697841. Task assignment is shown in table 3:

<table><caption>Table.3. task allocation</caption><thead><tr><th>VMID</th><th colspan="8">TASK ID</th></tr></thead><tbody><tr><td>0</td><td>27</td><td>73</td><td>97</td><td>50</td><td>16</td><td>15</td><td></td><td></td></tr><tr><td>1</td><td>72</td><td>0</td><td>56</td><td>58</td><td>68</td><td>94</td><td>42</td><td>14</td></tr><tr><td>2</td><td>9</td><td>84</td><td>43</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>3</td><td>3</td><td>74</td><td>46</td><td>54</td><td>13</td><td>17</td><td></td><td></td></tr><tr><td>4</td><td>11</td><td>49</td><td>86</td><td>24</td><td></td><td></td><td></td><td></td></tr><tr><td>5</td><td>90</td><td>88</td><td>98</td><td>93</td><td>47</td><td>8</td><td></td><td></td></tr><tr><td>6</td><td>7</td><td>71</td><td>62</td><td>30</td><td></td><td></td><td></td><td></td></tr><tr><td>7</td><td>63</td><td>59</td><td>22</td><td>37</td><td>55</td><td>95</td><td>87</td><td></td></tr><tr><td>8</td><td>38</td><td>70</td><td>77</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>9</td><td>51</td><td>89</td><td>75</td><td>10</td><td></td><td></td><td></td><td></td></tr><tr><td>10</td><td>52</td><td>36</td><td>91</td><td>18</td><td></td><td></td><td></td><td></td></tr><tr><td>11</td><td>85</td><td>44</td><td>53</td><td>92</td><td>45</td><td>12</td><td>19</td><td></td></tr><tr><td>12</td><td>33</td><td>61</td><td>99</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>13</td><td>29</td><td>39</td><td>83</td><td>35</td><td></td><td></td><td></td><td></td></tr><tr><td>14</td><td>32</td><td>78</td><td>4</td><td></td><td></td><td></td><td></td><td></td></tr><tr><td>15</td><td>28</td><td>66</td><td>1</td><td>26</td><td>20</td><td></td><td></td><td></td></tr><tr><td>16</td><td>6</td><td>21</td><td>64</td><td>67</td><td>40</td><td>82</td><td></td><td></td></tr></tbody></table>
<table><tr><td>17</td><td>31</td><td>34</td><td>57</td><td>80</td><td>81</td></tr><tr><td>18</td><td>23</td><td>65</td><td>96</td><td>76</td><td>2</td><td>60</td><td>48</td></tr><tr><td>19</td><td>25</td><td>69</td><td>79</td><td>5</td><td>41</td></tr></table>

## 4 Conclusion

In this paper, a method of load balancing for Cloud Computing Based on ant colony algorithm is proposed, and simulation experiments are carried out. The method guarantees that all virtual hosts can receive task assignments as evenly as possible, and that the total time of task completion is as short as possible. It can be seen that ACO has the following characteristics in load balancing:

As the ants continue to spread pheromones to the environment, new information will soon be updated to the environment, with dynamic characteristics.

Each ant makes its own choice according to the environment, and also sends out its pheromones. Therefore, ACO has distributed features.

Ants share environmental information and influence environment at the same time, so ACO has the characteristics of cooperative operation.

These characteristics are consistent with the super large scale, heterogeneous and real-time characteristics of cloud computing, so ACO is important for load balancing. Although ACO can solve the problem of load balancing, but also has the following problems need further study:

Load balancing is a multi-dimensional and multi constrained QoS problem. In this paper, the shortest time problem in load balancing is discussed, as well as the minimum transfer and the economic principle.

ACO needs to initialize some parameters, and the choice of parameters has an important influence on the performance and the final results. Therefore, in the cloud computing environment, the setting of various parameters needs further study.

The search time of ACO is too long, and the convergence speed is slow. How to combine ACO with neural network and particle swarm algorithm to improve the performance and efficiency of the algorithm in order to meet the requirements of response time and response speed of cloud computing.

## References

1. Liu Peng. Cloud computing (Third Edition) [M]. Beijing: Publishing House of electronics industry, 2015.

2. Li Fenghua. Research on load balancing scheduling algorithm of cloud computing resource based on ant colony algorithm [D]. Yunnan: Yunnan University, 2013.

3. Zhang Ning. Research on task scheduling of cloud computing based on adaptive ant colony algorithm [D]. Dalian: Dalian University of Technology, 2015.

4. Kong Lingjun, Zhang Xinghua, Chen Jianguo. Basic ant colony algorithm and its improvement [J]. Journal of Beihua University, 2004, 5 (6):572-574.
5. Ye Zhiwei, Zheng Zhaobao. The parameters alpha, beta in the ant colony algorithm, with an example of TSP problem [J]. Journal of Wuhan University, 2004 of P set, 29 (7):597-601.

6. Wang Xiajun.Cloudsim, cloud computing simulation tools, research and application of [J]. micro computer applications, 2013, 29 (8):59-61.

7. Tian Qinghua.An Abstract of Ant Colony Optimization [J].Shijiazhuang: Journal of Shijiazhuang Vocational Technology Institute,2004,16(6):37-38.

8. Zhang Hang,Luo Xiong.Status and Prospect of Ant Colony Optimization Algorithm [J].Human:Information and Control,2004,33(3):318-324.