• Tidak ada hasil yang ditemukan

Scheduling n tasks of same type (Case 1: (e, d))

5.6 Scheduling Methodology for the Systems with General Specifica-

5.6.1 Scheduling n tasks of same type (Case 1: (e, d))

5.6 Scheduling Methodology for the Systems with

1. If n is a perfect multiple of β then all the tasks are scheduled according to our method and the number of hosts required to execute all the tasks will be m= nβ, where n is the number of tasks in the request.

2. If n is not multiple of β then m=bnβc −1 number of hosts will execute mβ tasks and the remaining tasks (n−mβ) are scheduled according to the base case. The remaining number of tasks are guaranteed to be less than 2β.

For scheduling the tasks in the base case, we have used a first fit method. For this, we have sorted the tasks in decreasing order of their utilization requirements and the VMs are allocated to hosts using the first-fit approach for bin packing.

Instead of taking bin capacities as 1, we take these as uc+ut. Moreover, in this case, the tasks have the same specifications, so, we do not need to sort them. Also, the maximum value of β can be 5 (when the least feasible VM type is tiny with uT = 0.2), the maximum number of tasks that will be in the base case is 10.

Energy consumption in this case is given by, E =m.e

u.α(2uc3

+ (uβ)3) +Ebase (5.11)

wheremis the number of active hosts, ue is the execution time of a task (or we can say the time for which the hosts are active),α(2uc3+(uβ)3) is the amount of power consumption of each host and Ebase is the energy consumption for scheduling of the tasks that are in base case.

We have a set of suitable VM types for a task which can complete the task before its deadline. For choosing the best VM type among the suitable VM types, we have computed certain relation through which we can make the decision based on the value of uc of the hosts.

1. Relation between β and γ for same VM type: Letube the utilization provided by current VM type and n1 and n2 be the total number of hosts needed with β and γ number of VMs per host, respectively. Schedule with γ number of VMs per host consumes lesser energy than the schedule with β number of VMs per host when total energy consumption in former case is lesser as compared to total energy consumption in the latter case (can be derived from Equation 5.11). The high number (γ) of VMs per host is preferable if The high number (γ) of VMs per host is preferable if

n2.e

u.α(2uc3

+ (uγ)3)< n1.e

u.α(2uc3

+ (uβ)3) 2n2uc3 −2n1uc3 < n1(uβ)3−n2(uγ)3

uc< u3

sn1β3−n2γ3

2(n2−n1) (5.12)

For example, when the least feasible VM type is S (uS = 0.4) and uc ∈ (0.40,0.49], the resulting values of β and γ are 2 and 1, respectively. And in this case, schedule with one VM per host consumes lesser energy as compared to the schedule with two VMs per host.

2. Relation between two different VM types: Letu1 andu2 be the values of utilizations provided by the two VM types which we need to compare.

The corresponding number of tasks per host be β1 and β2, as a result of above relation. Let m1 and m2 be the corresponding number of hosts and u1 < u2. Choosing the VM with higher utilization will give lesser energy consumption when

m1. e u1

.α(2uc3

+ (β1u1)3)> m2. e u2

.α(2uc3

+ (β2u2)3) m1u2(2uc3+ (β1u1)3)> m2u1(2uc3+ (β2u2)3) 2uc3

(u1m2−u2m1)< m1u21u1)3−m2u12u2)3 (5.13) For example, when the least feasible VM type is S and uc ∈ (0.50,0.69], schedule using L type of VMs consumes lesser energy as compared to the schedule using S type of VMs.

Pseudo-code for scheduling the single type of tasks is shown in Algorithm 8. We start with finding the minimum utilization required by the tasks. Based on the minimum utilization required, we select the VM type with the least utilization among the set of suitable VM types. We call the utilization of this VM type u1. This can also be calculated as u = l

e d ·5m

/5. Then, we check the satisfiability of the relation given in Equation 5.12 to choose the number of tasks per host to execute. If it gets satisfied then schedule with γ VMs per host performs better than the schedule with β VMs per host. The chosen number of VMs per host is set as β1 and the corresponding number of hosts is assigned to m1. Similarly, for the next VM type with utilization u2, find the values of β2 and m2. Now, we check which of the two VM types gives us better results. For this, we check

Algorithm 8 Scheduling single type of tasks S(e, d, n)

1: Allocate the VM with minimum utilization required by the task from T, S, M, L and XL. Let it be u.

2: Number of tasks per host when total utilization is more thanuc,β ← duuce

3: Number of tasks per host when total utilization is less than uc, γ ← buucc

4: Find the number of hosts in each case. Let they be n1 and n2, respectively

5: if uc < u·q3

n1β3−n2γ3 2(n2−n1) then

6: β1 ←γ . γ VMs per host consumes less energy

7: Number of hosts, m1 ←n2

8: else

9: β1 ←β . β VMs per host consumes less energy

10: Number of hosts, m1 ←n1

11: u1 ←u

12: Similarly choose β2 and m2 for u2 =u1+ 0.2 if u1 ≤0.8

13: if 2uc3(u1m2−u2m1)< n1u21u1)3−n2u12u2)3 then

14: uf ←u2, βf ←β2 and mf ←m2

15: u←u2 goto step 2

16: else

17: uf ←u1, βf ←β1 and mf ←m1

18: Allocate VMs with utilization uf to the tasks.

19: Schedule βf number of VMs on each host.

20: Schedule the remaining number of tasks i.e. n−mfβf according to base case.

whether the relation given in Equation 5.13 gets satisfied. If yes, the higher VM type with utilization u2 gives better result than the VM type with utilization u1

and continue withu2 asu. Otherwise,u1 performs better than u2. Store the final utilization values as uf, βf and mf, where uf is the utilization provided by the selected VM type, βf is the number of VMs to be scheduled on one host and mf

is the total number of hosts required (without considering the tasks that fall into base case). Then we allocate the tasks to VMs with utilizationuf and schedule βf

VMs on a host and the remaining tasks are scheduled according to the base case.

Algorithm 8 gives the schedule with the lowest energy consumption, but, we have some special cases, where the two relations in Equation 5.12 and 5.13, can be simplified further. They would not make any change to the decision made by the algorithm, so, whenever the task set of user request falls in one these cases, we can safely replace the relations with the resulting ones. These special cases are:

• Relation between energy consumption with β and γ number of tasks per host when total number of tasks is a multiple of both:

Let n be the number of tasks in user request which satisfies n%β = 0 and

n%γ = 0. Letn1andn2 be the number of hosts in case ofβ andγ number of VMs per host, respectively. Then n1 = βn and n2 = nγ. Energy consumption is lower with γ number of VMs per host when a VM with utilization u is used if the following condition is satisfied

n γ.e

u.α(2uc3

+ (uγ)3)< n β.e

u.α(2uc3

+ (uβ)3)

⇒2uc3+ (uγ)3

γ < 2uc3+ (u(γ+ 1))3

γ+ 1 [as β =γ+ 1]

⇒(γ+ 1)(2uc3

+ (uγ)3)< γ(2uc3

+ (u(γ+ 1))3)

⇒2uc3+ (uγ)3 < γu3(3γ2+ 3γ+ 1)

⇒uc< 3

rγu3(2γ2+ 3γ+ 1)

2 . (5.14)

So if the above Equation is satisfied then the γ number of VMs per host is allocated to have minimum energy consumption, otherwise β number of VMs per host have lesser energy consumption.

• Comparing energy consumption by two different VM types when number of tasks is a multiple of both β1 and β2: Letn is the number of tasks andu1 and u2 (u1 < u2) be the values of utilization provided by the two VM types that need to be compared. If β1 and β2 are the respective number of tasks per host and n satisfies n%β1 = 0 and n%β2 = 0 , then energy consumption is lower atu2 if:

n β2

. e u2

.α(2uc3+ (u2β2)3)< n β1

. e u1

.α(2uc3+ (u1β1)3) u1β1(2uc3

+ (u2β2)3)< u2β2(2uc3

+ (u1β1)3) 2uc3(u1β1−u2β2)< u2β2(u1β1)3 −u1β1(u2β2)3 2uc3

(u1β1−u2β2)< u1u2β1β2

((u1β1)2−(u2β2)2) 2uc3(u1β1−u2β2)< u1u2β1β2(u1β1−u2β2)

(u1β1+u2β2) The final relation depends on the value of (u1β1−u2β2).

2uc3 > u1u2β1β2(u1β1+u2β2) (u1β1 −u2β2)<0 2uc3 < u1u2β1β2(u1β1+u2β2) else

 uc> 3

qu1u2β1β2(u1β1+u2β2)

2 (u1β1−u2β2)<0 uc< 3

qu1u2β1β2(u1β1+u2β2)

2 else

(5.15)

• When β1 and β2 are equal in the above case: This case refers to a situation where both values of utilization result in same β values. Since u2 > u1 andβ12 , say β, the value ofu1β1−u2β2 will always be less than 0. Therefore, q3

1

2u1u2ββ(u1β+u2β) can be written as βq3

1

2u1u2(u1+u2).

So if the following condition uc> β 3

r1

2u1u2(u1+u2) (5.16) is satisfied then, the VM type with higher utilization will consume lesser amount of energy as compared to the VM type with lesser utilization value.

5.6.2 Scheduling approach for two types of tasks having