Algorithm 2: The calc() method of the energy-aware Bro-
kering Algorithm (eBA).
1: de f ine h num = hMapO f f .count(reqsTags.h)
2: de f ine worst c f [h num]
3: de f ine worst cost[h num]
4: for j = 1 to h num do
5: o f f num = hMapO f f .count(reqsTags.h. j)
6: de f ine co2 f oot print[h num][o f f num]
7: de f ine cost[h num][o f f num]
8: de f ine opt[h num][o f f num]
9: for i = 1 to o f f num do
10: de f ine av, price, iteu, itee, pue, gec, cdie
11: de f ine w, p
basic
, t0, h, d ppe, k, a, N
12: av = hMapO f f . j.i.availability
13: price = hMapO f f . j.i.price
14: iteu = hMapO f f . j.i.iteu
15: itee = hMapO f f . j.i.itee
16: pue = hMapO f f . j.i.pue
17: gec = hMapO f f . j.i.gec
18: cdie = hMapO f f . j.i.cdie
19: w = hMapO f f . j.i.workload
20: p
basic
= hMapO f f . j.i.p
basic
21: t0 = hMapO f f . j.i.tstart
22: h = hMapO f f . j.i.h
23: d ppe = d ppe f unc(iteu, itee, pue,gec)
24: k = k f unc(cdie,d ppe)
25: co2 f oot print[ j][i] =
integral(t0,h, w,k,av, p
basic
)
26: cost[ j][i] = cost f unc(price,h)
27: end for
28: worst c f [ j] = max(co2 f oot print, j)
29: worst cost[ j] = max(cost, j)
30: for i = 1 to o f f num do
31: opt[ j][i] = a ∗ (co2 f oot print
j,i
/worst c f
j
) +
(a − 1) ∗ (cost
j,i
/worst cost
j
)
32: hMapO f f . j.i.update(co2 f oot print,cost, opt)
33: end for
34: end for
5.2 Simulation Environment
In the J2CBROKER simulator, both the client
and server sides use their own mandatory
client json con f and server json con f configu-
ration files to dynamically set features and behavior
during the simulation steps. The first one contains
information about the server application and several
fields which are used for the dataset simulation
phase. The second one contains information about
the server-side elaboration phase. The Random Simu-
lation Mode (we use in our simulation at client-side)
allows the random creation of the datasets to send
at the server-side broker algorithm for computation.
The Guided Simulation Mode, instead, allows the
user to specify the list of the dataset files for the
server-side broker algorithm. The communication
between client and server is made through the HTTP
POST requests exchange. The output of the simu-
lation is a json file which contains the results of the
elaborations done by the server-side eBA Algorithm.
5.3 Experimental Results
This paragraph reports, in a graphical form, the re-
sults produced by the simulations, based on a number
of 1000 samples. Figures 2 and 3 show distinct re-
sults for the different running time h (as reported in
service dataset) and based on the established parame-
ters (i.e., weight a, confidence in terms of percentage
and number N of instances to allocate). In particular,
the weight a is a value in the [0,1] range and it is part
of the ‘opt’ Formula at the line 31 of the Algorithm 2.
It is used to assign a weight for each offer in terms
of sustainability and cost (the sum of the attributed
weight equals one).
Figure 2 shows four examples among the simu-
lated scenarios by using two typologies of graphs, i.e.,
kgCO2/DPPE vs h and cost vs h. They refer to four
different number N of instances in each request (see
Service Dataset in TABLE 1 and line 11 in the Al-
gorithm 2). Examples report a weight parameter a
equals 0.5 (that means to assign the same weight for
sustainability and cost) and a 95% in confidence in-
tervals for the selected kgCO2/DPPE (i.e. the carbon
dioxide emission compared with the DPPE expressed
by the Formula (2)) and cost indexes. The purpose
of these graphs is to give a clear indication on the
amount of carbon dioxide emission-per-DPPE and the
cost (i.e., money) varying the running time h at each
Cloud site. If compared with the others through the
y-axis reading, the fourth graph on the left shows that
the carbon dioxide emission-per-DPPE confidence in-
terval is more restricted. This means that the proposed
algorithm encourages the broker in to select the ‘best’
offers in the presence of a high number of instances
to allocate for each request. The same by reading the
related cost graph (on the right). Furthermore, even
if both carbon footprint and cost grow with N and h,
their relative kgCO2/DPPE and cost confidence in-
tervals are below the 67% in the most expensive of all
(N=50, h=750), that is a 23% less in wasteful among
the Community Clouds.
Figure 3 shows the confidence interval of the opt
index for one instance allocation. The values reported
in Figure 3 are the result of a post-processing phase,
by getting as input all the best opt values calculated
at each run step. If we consider, in fact, that for each
run in our simulation, the worst case results in an opt
index closer to one, the eBA Algorithm at Broker is
able to select sets of offers with an opt index lower
than 0.12, that is very low if compared with the worst
An Energy-aware Brokering Algorithm to Improve Sustainability in Community Cloud
171