*2.2.2 Intra grid load balancing algorithm*

Load balancing at this level is used if the Cluster Agent fails to balance its load among its related resources. In this case, each overloaded cluster migrates Worker Agents from its overloaded resources to underloaded clusters. In contrast to the intra-cluster level, we should consider the communication cost among clusters. Knowing the global state of each cluster, the overloaded cluster can send its Worker Agents for under-loaded clusters. The selected under-loaded clusters are those that require minimal communication cost for migrating agents from overloaded clusters. The agent can be transferred only if the sum of its latency in the source cluster and cost transfer is lower than its latency on the receiver cluster. This assumption will avoid making useless agent migration.

We associate a period to each Cluster Agent, during which each Cluster Agent sends its current load information to the other clusters. So, a Cluster Agent can receive new load information about another one at any time. This updated information will be considered in the next period.

Cluster Agent: intra-grid load balancing algorithm Input: Loadcluster

Output: Sender Resource, Receiver Resource { If (events\_happens () =7) then { Receives Loadcluster of other clusters of grid; Collects Loadcluster in the table of clusters information Sort table of clusters information by ascending order relative to their load Select the first cluster as receiver cluster; Sorts the resources of receiver cluster by ascending order of their load Receiver Resource = the first resource of list of resources in receiver cluster Sorts the resources of current cluster by descending order of their load Sender Resource = the first resource of list of resources in sender cluster Sorts Worker Agents of first resource of current cluster by selection policy and communication cost; Sends this information for the Migration Agent }

In **Figure 4**, we are using the H threshold = 0.9. So, to find the best value of the lower threshold we executed our load balancing algorithm 10 times for the different values of the L threshold L = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, and we observed the number of migration. We found that number of migration augmented with the

We modeled the complex data set from the National Grid of Czech republic MetaCentrum, these data permit us to implement very realistic simulations. Also, it offers information about machine failures and specific job requirements and that information influences the quality of solutions generated by the scheduling algorithms. Job description includes (Job ID, user, queue, number processors used, etc.). Also, the description of clusters includes complete information with RAM size, CPU speed, CPU architecture, operating system, and the list of supported properties (cluster location, allowed queue (s), and network interface, etc.). Additionally, information machines were in maintenance (failure/restart). Finally, the list of queues containing their time limits and priorities is provided. More details on

A class library was developed that simulates the activities of an agent platform. This library, called ABLBM (Agent-based load balancing), includes the classes: Grid Agent, Cluster Agent, Migration Agent, LBC Agent, and Resource Agent. The simulation is initialized by the Grid Agent class which makes instances of resources, jobs, and other entities as required by the GridSim standard. Grid Agent reads information describing the grid resources and jobs from a data file, reads the jobs from the data\_set file, and dynamically produces the job instances over time. **Figure 5** specifies the Grid Resource parameters such as resource ID, resource's CPU speed, and resource's memory capacity. Next, Grid Agent lists all the available grid resources within the grid environment. When the simulation time is equal to the job submission time, the Grid Agent starts the Cluster Agent and dynamically sends the

Based on its own load and the estimated balance threshold, Cluster Agent analyzes the load state of the cluster. In the imbalance state, Cluster Agent defines the

value of L threshold. It offers the best result at L = 0.3.

*Agent Based Load Balancing in Grid Computing DOI: http://dx.doi.org/10.5772/intechopen.94219*

the trace file used can be found at [9].

jobs created for the Resource Agents over time.

**3.2 The simulation environment**

**3.1 Workload**

**Figure 5.** *Grid agent interface.*

**67**

## **3. Implementation**

We implemented a system prototype using JADE [6] (Java Agent Development Framework) for agent implementation, and Alea 2 [7] (Job Scheduling Simulator based on GridSim) as a simulator of the grid. Alea 2 is based on GridSim Toolkit [8] and represents an extension that contains better tools for scheduling algorithm implementation visualization competency and an upper speed of simulations.

To find the constant H for calculating the higher threshold, we execute our load balancing method 10 times for the different values of H = 0.5, 0.6, 0.7, 0.8, 0.9, and observed number of migration.

**Figure 3** demonstrates the number of migration for the different values of H threshold. The number of migration augments with H threshold values but when the value of H threshold changes to 0.9 and 1, the number of migration is augmenting intensely. So we set the value of H threshold at 0.9.

**Figure 3.** *Number of migration on different value of H.*

**Figure 4.** *Number of migration on different value of L.*

In **Figure 4**, we are using the H threshold = 0.9. So, to find the best value of the lower threshold we executed our load balancing algorithm 10 times for the different values of the L threshold L = 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, and we observed the number of migration. We found that number of migration augmented with the value of L threshold. It offers the best result at L = 0.3.
