• No results found

A new Genetic Algorithm Based Job-Scheduler

4 The InterCloud Interoperability Framework (ICIF)

4.4 A new Genetic Algorithm Based Job-Scheduler

The Cloud Subscriber workloads consist of multiple jobs, with QoS constraints and the job model defined in section ‎4.3.1. The Cloud Subscriber has limited number of resources, thus, it

Transformation Engine Transformation CIM level Job’ in CPx PIM level Job’ in CPx PSM level Job’ in CPx Code level Job’ in CPx Map to Map to Map to Map to Interoperability CIM Model Interoperability PIM Model Interoperability PSM Model Interoperability Code Map to Map to Map to Map to Transformation Transformation CIM level Job in CS PIM level Job in CS PSM level Job in CS Code level Job in CS

110

requires migrating the workload on the other Cloud Providers to deliver better QoS. We assume each job has a number of QoS requirements that should be full filled within a specified deadline; otherwise there is a pre-decided penalty cost. Hence, a job-scheduler is required to be defined as a functionality component of our interoperability framework. The job-scheduler should be able to distribute the jobs to the available Cloud Providers effectively.

As a traditional problem, it is proven that finding an optimised job scheduling solution for distributing the multiple job operations, with QoS constraints in a distributed environment is a nondeterministic polynomial time (NP-complete) problem [18][214]. Therefore, we must use a heuristic job scheduling solution to reduce the overall cost and increase the performance. This PhD thesis proposes a job scheduler based on iterative Genetic Algorithm (GA) [215]. We assumed the job that has smaller "MaxWaitingTime" or ―deadline‖ should receive service sooner. Figure ‎4-11 is showing one example: the queue holds the ID number of jobs and we assumed the ID of new job with ―MaxWaitingTime‖ between dS and dS+1 should be add

accordingly to the right place in the queue between Job IDS and Job IDS+1. If there exist jobs

with the same ―MaxWaitingTime‖, the ID of new job should be added to the end of the series. It should be mentioned that the value of ―MaxWaitingTime‖ variable reduces by time.

Figure 4-11 It is assumed the ID of new job with “MaxWaitingTime” between dS and dS+1 should be add accordingly to the right place in the queue between Job IDS and Job IDS+1. The proposed job scheduling algorithm is shown in Figure ‎4-12. In this algorithm, there are a number of input variables:

1. A Job-Queue with priorities that each jobi is specified with a set of Requirements: {𝑡𝑖,

Job ID1 Job ID2 ... Job IDs Job IDs+1 ...

Job + JobID : + MaxWaitingTime : d Job ID 1 ... ... 1

Start point of Queue

Job + JobID : + MaxWaitingTime : d Job ID 2 ... ... 2 Job + JobID : + MaxWaitingTime : d Job ID s ... ... s

...

Job + JobID : + MaxWaitingTime : d Job ID s+1 ... ... s+1

...

The place that new

111

𝑐𝑝𝑖, 𝑏𝑖, 𝑚𝑖, 𝑑𝑖, 𝑝𝑖}. Where the 𝑡𝑖 is serving time, 𝑐𝑝𝑖 is computing power requirement, 𝑏𝑖 is bandwidth requirement, 𝑚𝑖 is memory requirement, 𝑑𝑖 is maximum possible waiting time, and finally 𝑝𝑖 is number of related pricing policy based on the service price and the SLA contract between CS and the application which requested computing resources.

2. The list of dynamic performance history of each Cloud Provider.

3. ―x‖: It is the number of jobs for each step that will be explain in an example. 4. ―n‖: It is iteration number will be explain in an example.

5. ―crossover-rate‖: It is a rate of a process that takes more than one parent solutions and producing a child solution from them. Here the parents are the pattern of series of CPs allocated to the jobs at each step.

6. ―mutation-rate‖: In GA, "mutation" is a genetic operator that modifies some gene values in a chromosome from its original state. This operator intends to maintain genetic diversity with mutation-rate from one generation of a population of genetic algorithm chromosomes to the next.

112

Figure 4-12. The Genetic Algorithm based model for distributing jobs on the selected Cloud Providers.

Begin

Inputs:

1- A Job-Queue with priorities, Each jobiwith

a set of Requirements : {ti, cpi, bi, mi, di, pi}

2- The dynamic performance history of each CP 3- crossover-rate

4- mutation-rate

5- x (number of jobs for each step) 6- n (iteration number)

7- acceptable queuing time

Evaluate the fitness function for distribution patterns and save the results

iteration =< n

Do the crossover operation with the crossover-rate, distribute x jobs on the CPs each crossover pattern,

evaluate fitness function for each distribution

Do the mutation operation for mutation-rate,

distribute x jobs on the CPs for each mutation pattern, evaluate the fitness function for each distribution

Average queuing time <= acceptable queuing time Distribute first x jobs from queue randomly on the CPs (if possible)

save the distribution pattern

Keep n pattern with the bests fitness evaluation results

yes

No yes

No

end Distribute the jobs based on the pattern

with the best fitness evaluation function

The Job-Queue is empty

113

Defining an applicable fitness function is essential and having strong effect on the convergence rate of GA and achieving the optimal solution. This thesis considered two main factors to define the fitness function:

1. The Performance of each IaaS CP: The framework allocates a performance history variable 𝑝ℎ𝑘 to each IaaS Cloud Provider 𝐶𝑃𝑘. ICIF framework sends a test workload to each Cloud Provider 𝐶𝑃𝑘 periodically and updates the performance variable 𝑝ℎ𝑘 according to the 𝐶𝑃𝑘‘s resource availability and 𝐶𝑃𝑘‘s response time. The variable 𝑝ℎ𝑘𝑡 is the average of

𝑝ℎ

𝑘𝑡−1 with factor of (m-1) and the last resource availability and response time:

𝑝ℎ

𝑘𝑡

=

( 𝑚 − 1 ∗ 𝑝ℎ

𝑘𝑡−1

Availability

𝑘𝑡

ResponseTime

𝑘𝑡

)

𝑚

The GA solution should maximize the sum of 𝑝ℎ𝑘 for all k (available CPs).

2. The Cost: The ICIF framework has the SLA repository based on the agreement between CS and CPs that includes the price lists for different computing resource offering. The 𝑐𝑜𝑠𝑡𝑖𝑘 is the cost of computing resource offering from Cloud Provider 𝐶𝑃𝑘 for the requirement of job 𝑗𝑖. The GA solution should minimize the overall cost. In our GA based solution, the fitness function is defined as:

𝑓 =

𝑝ℎ

𝑗𝑖

𝑐𝑜𝑠𝑡

𝑗𝑖

Where 𝑝ℎ𝑗𝑖 is the performance of the CP which provides resources for job 𝑗𝑖 with the 𝑐𝑜𝑠𝑡𝑗𝑖.

To describe the algorithm, we give a small example. To simplify the example we assume all Cloud Providers (CPs) are able to deliver all job requirements. In this example we consider there are 4 CPs available to corporate with Cloud Subscriber, the x is 50 jobs, and the iteration number n is 20 (shown in Figure ‎4-13). Additionally, we assumed the crossover − rate = 0.1 and the mutation − rate = 0.02. In real scenario we run the simulation model for different values for crossover-rate and mutation-rate, and finally we achieve the values of these factors of GA based solution for the best performance/cost results.

114

Figure 4-13 An example for proposed GA-based job-scheduler to distribute jobs from Cloud Subscriber to 4 other Cloud Providers. It is assumed that number of jobs for each step is x=50,the iteration number is n=20, the crossover-rate is 0.1 and the mutation-rate is 0.02. As shown in Figure ‎4-13, the algorithm starts with random allocation of CPs to a series of 50 jobs and evaluates the fitness function for each series of allocation. The algorithm repeats this step for n=20 times and save the allocation patterns and the fitness evaluation results. Then, algorithm applies the crossover operation with the rate of 0.1 on the series of CPs allocation and distributes 50 jobs on the CPs for each crossover pattern and evaluates fitness function for each distribution. Similarly, algorithm applies the mutation operation with the rate of 0.02 on the series of CPs allocation and distributes 50 jobs on the CPs for each mutation pattern and evaluates fitness function for each distribution. Afterward, if the average queuing time is smaller than acceptable queuing time, the algorithm distributes the jobs based on the pattern with the best fitness evaluation functions, otherwise repeats the crossover and mutation operation steps. The algorithm repeats this process of distributing the jobs on CPs till the queue is empty.

Job1 Job2 Job3 Job4 Job5 Job6 Job7 Job8 Job50

...

...

CP2 CP4 CP1 CP1 CP3 CP4 CP1 CP2 CP3

Job1 Job2 Job3 Job4 Job5 Job6 Job7 Job8 Job50

...

...

CP4 CP3 CP1 CP2 CP3 CP4 CP2 CP1 CP4

Job1 Job2 Job3 Job4 Job5 Job6 Job7 Job8 Job50

...

...

CP2 CP3 CP3 CP4 CP1 CP2 CP4 CP3 CP2

...

n=1 n=2 n=20

...

...

f1 f2 f20

115