Getting Started with GreenCloud Simulator

3
11064

Green Cloud

GreenCloud enables the detailed modelling of the energy consumed by a data centre’s IT equipment. In this article, the author discusses the installation of GreenCloud, and walks the reader through a few simulation exercises by changing the parameters of the cloud as well as the source code.

GreenCloud is a packet level simulator that uses the existing Network Simulator 2 (NS2) libraries of data centres to track the energy consumed by the different components of a cloud computing environment. It models the various entities of the cloud such as servers, switches, links for communication, and the energy they consume.

It can be helpful in developing solutions to monitor and allocate resources, to schedule workloads for a number of users, optimise the protocols used for communication and also provide solutions for network switches. Data centre upgradation or extension can be decided on using this tool.

NS2 uses two languages, C++ and OTcl (Tool Command Language). The commands from Tcl are usually passed to C++ using the interface, TclCL. GreenCloud uses 80 per cent of the coding done using C++ (TclCL Classes), and the remaining 20 per cent coding is implemented using Tcl scripts (commands are sent from Tcl to C++).

GreenCloud has been developed by the University of Luxembourg and released under the General Public License (GPL).

Installation of GreenCloud
The GreenCloud tool has been developed mainly for Debian-based systems (like Ubuntu, Debian, Linux Mint, etc). The tool will work comfortably with Ubuntu 12.x and later, with kernel version 3.2+. GreenCloud also comes with a pre-configured VM that includes Eclipse to debug NS2, modifying the source code and to start or run simulations.

Here are the instructions for GreenCloud on a non-VM machine. Download the software from this URL: http://greencloud.gforge.uni.lu/ftp/greencloud-v2.0.0.tar.gz. Then execute the commands as specified below:
Unzip or untar the software using the command

pradeep@localhost $] tar zxvf greencloud-v2.0.0.tar.gz
pradeep@localhost $] cd greencloud-v2.0.0
pradeep@localhost greencloud-v2.0.0 $] ./configure
pradeep@localhost $] ./install-sh

This will install almost as 300MB of software with the dependencies. You need to press “Enter” manually for fewer number of times during the installation, If the installation is unsuccessful, correct the dependencies.
Execute the script by running (This command will pop out a window in a browser with a test simulation data)

pradeep@localhost $] ./run

Sample simulation
GreenCloud comes with a default test simulation of 144 servers with one cloud user. All the parameters can be varied and tested based on the inputs given to the Tcl file.
The Tcl files are located under the ~greencloud/src/scripts/ directory. There are many scripts that specify the functionality of the cloud environment:

  • main.tcl –  specifies the data centre topology and simulation time
  • topology.tcl – creates the network topology
  • dc.tcl – creates the servers and VMs
  • setup_params.tcl – general configuration of servers, switches, tasks, etc
  • user.tcl – defines the users and their behaviour
  • record.tcl – reports the results
  • finish.tcl – prints the statistics

The output can be viewed via the browser using the show-dashboard.html file by running the ./run script.
The ./run script consists of the following parameters: data centre load, simulation time and memory requirement.

The data centre load specifies the value from 0 to 1 (values near 0 indicate the idle data centre, while the load closer or greater than 1 indicates saturation of the data centre). The simulation time specifies the task that can be scheduled under a VM or a single host, based on the deadlines of the task.

The simulation results are processed in the <em>~greencloud/traces/ directory</em>. There are various trace files that record the information from the data centre: load, main tasks, switch tracing, loading, etc.

Changing the parameters of the cloud
The parameters of the data centre can be changed using the Tcl files that were shown in the previous section. A simple change is shown below.  Two files (main.tcl and topology.tcl) are modified catering to 40 servers and a single user cloud data centre with an average load capacity of 0.3 .

#topology.tcl, where the network topology is been set 
switch $sim(dc_type) {  
  "three-tier high-speed" {  
    set top(NCore)        2            ;# Number of L3 Switches in the CORE network  
    set top(NAggr)        [expr 2*$top(NCore)]    ;# Number of Switches in AGGREGATION  
    set top(NAccess)        256            ;# Number switches in ACCESS network  
    set top(NRackHosts)    3        ;# Number of Hosts on a rack  
  }  
  "three-tier debug" {  
    set top(NCore)        1            ;# Number of L3 Switches in the CORE network  
    set top(NAggr)        [expr 2*$top(NCore)]    ;# Number of Switches in AGGREGATION  
    set top(NAccess)        2            ;# Number switches in ACCESS network per pod  
    set top(NRackHosts)    20            ;# Number of Hosts on a rack  
  }  
  # three-tier  
  default {  
    set top(NCore)        8            ;# Number of L3 Switches in the CORE network  
    set top(NAggr)        [expr 2*$top(NCore)]    ;# Number of Switches in AGGREGATION  
    set top(NAccess)        64            ;# Number switches in ACCESS network  
    set top(NRackHosts)    3            ;# Number of Hosts on a rack  
  }  
}  

# Number of racks is set as 2 * 1 
set top(NRacks) [expr $top(NAccess)*$top(NCore)]  

# Number of servers is set to 2 * 20 (40 servers) 
set top(NServers) [expr $top(NRacks)*$top(NRackHosts)]  
…... 

#main.tcl, where the simulation information and data centre load information is specified 
# Type of DC architecture  
set sim(dc_type) "three-tier debug" 

# Set the time of simulation end  
set sim(end_time) [ expr 60.1 + [lindex $argv 1] ]     ;# simualtion length set to 60 s + deadline of tasks  

# Start collecting statistics  
set sim(start_time) 0.1  

set sim(tot_time) [expr $sim(end_time) - $sim(start_time)]  

set sim(linkload_stats) "enabled"  

# Set the interval time (in seconds) to make graphs and to create flowmonitor file  
set sim(interval) 0.1  

# Setting up main simulation parameters  
source "setup_params.tcl"                  

# Get new instance of simulator  
set ns [new Simulator]  

# Tracing general files (*.nam & *.tr)  
set nf [open "../../traces/main.nam" w]  
set trace [open "../../traces/main.tr" w]  

# Building data centre topology  
source "topology.tcl"  
…......

The graph in the browser shows four parts: the simulation data as shown in Table 1, the data centre characteristics as shown in Figure 2, the DC network characteristics as shown in Figure 3 and the energy consumption details as shown in Figure 4.

Figure 1 Simulation summary
Figure 1 Simulation summary
Figure 2 Data centre characterisitcs
Figure 2 Data centre characterisitcs
Figure 3 Data centre network character
Figure 3 Data centre network character
Figure 4 Energy consumption details
Figure 4 Energy consumption details

 

Multiple simulations can be performed using a single run script. In that case, the results are plotted as a tabbed pane.

To modify the existing source code
The above examples show the parameter changes in the existing network and how to analyse the results. However, if a researcher is trying to configure a CPU or, a HPC cluster, alter cache memory, handle virtual machines, etc, then there should be code modification in the source files (.cc and .h).

These files are located in the ~greencloud/build/ns-2.35/greencloud/ directory and are already compiled as object files. Any changes to these files need a compilation as specified below:
Once the cpu.cc file is modified, it will be compiled using the make command as shown below.

~pradeep@localhost $] cd /home/pradeep/greencloud/build/ns-2.35/
~pradeep@localhost ns-2.35 $] make

If new set of files (newfile.cc and newfile1.cc) are added, those details have to be added to ~ns-2.35/Makefile.in as specified below in the OBJ_CC variable. For each .cc file, there need to be a .o file to be added.

OBJ_CC = \
    ...
    greencloud/newfile.o \
    greencloud/newfile1.o \

GreenCloud is the best open source tool to analyse the performance of a data centre. The parameters of the cloud can be varied, and it comes with a provision to add or modify existing source code to define new metrics for a cloud. Any questions on installation or tuning  GreenCloud are always welcome.

 

 

 

3 COMMENTS

LEAVE A REPLY

Please enter your comment!
Please enter your name here