Queuing Models in NS2

M/M/1 is a system with poisson arrival time, servicing exponentially and a queue of unlimited capacity and type of FIFO Queue. This is the simplest queuing system.  NS2 supports various distributions like pareto, exponential, constant, unifrom, etc to handle the network dynamics and metrics. So it is very easy to test the given network link to monitor a given queue using any of these queuing models. The listing 3 and 4 are monitoring the link when DropTail queue is used with a capacity of finite and infinite. Listing 13.3 uses infinite capacity and Listing 13.4 uses Finite capacity The output screen shot is shown below the scripts for further understanding
Listing 3 – M/M/1 Queuing Model #new Simulator creation set ns [new Simulator] #trace file creation for capturing the UDP data set tf [open out.tr w] $ns trace-all $tf
#setting the exponential distribution param set lambda 30.0 set mu     33.0
#creation of nodes set n1 [$ns node] set n2 [$ns node] #The queue limit is 1Lakh as the capacity is infin…

GreenCloud Simulator using NS2

Introduction to GreenCloud Simulator
GreenCloud is a packet level simulator that uses the existing Network Simulator 2 (NS2) libraries for energy-aware data centers for cloud computing. It models the various entities of cloud such as servers, switches, links for communication and their energy consumption.
It can be helpful in developing solutions for resource monitoring and allocation, scheduling workloads for number of users, optimizing the protocols used for communication and also provide solutions for network switches. The data center upgradation or extension may be decided using this tool.
NS2 uses two languages C++ and Otcl (Tool Command Language). The commands from TCL are usually passed to C++ using an interface TclCL. GreenCloud uses 80% of the coding is done using C++ (TclCL Classes) and remaining 20% coding is implemented using Tcl scripts (Commands are sent from Tcl to C++).
GreenCloud is developed by University of Luxembourg and released under the General Public License (GPL).

Installation of GreenCloud
GreenCloud Tool is developed mainly for debian based systems like (Ubuntu, Debian, Linux Mint, etc). The tool will be comfortably work with Ubuntu 12.x and afterwards with a kernel of 3.2+. GreenCloud also comes with a preconfigured VM which includes Eclipse to debug ns, modifying the source code and to start/run simulations.

Here is 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. Execute the command 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)


Sample Simulation
The GreenCloud comes with a default test simulation with 144 Servers with one Cloud User. All of 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 specifies the functionality of the cloud environment
main.tcl - specifies the data center topology and simulation time
topology.tcl – create the network topology
dc.tcl – creates the servers and VMs
setup_params.tcl – general configuration like servers, switches, tasks, etc
user.tcl – defines the users and their behaviors
record.tcl – reporting the results
finish.tcl – prints the statistics.

The output can be viewed using the browser using the show-dashboard.html file by running the ./run scripts.
The ./run scripts consists of the following parameters Data center load, Simulation Time and Memory requirement. The Data center load specifies the value from 0 to 1 (the values near 0 indicates the idle data center and while the load closer or greater than 1 indicates the saturation of data center). 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 ~greencloud/traces/ directory. There are various trace files that records the information from data center load, main tasks, switch tracing, loading, etc.

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

#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 center 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 center topology
source "topology.tcl"

Table 1: Simulation Data
Data center Architecture
Three tier debug
Core Switches
Aggregation Switches
Access Switches
Number of Servers
Average Load/Server
Total tasks
Average Task/Server
Total Energy Calculated
322.7 Watt Hour
Server Energy
164.1 Wh
Total Switch Energy
158.6 Wh

GreenCloud using NS2
Simulation Summary

GreenCloud using NS2
Data Center characteristics

GreenCloud using NS2
Data Center Network Characteristics

GreenCloud using NS2
Energy consumption details

The graph in the browser shows 4 parts, Simulation summary as shown in Table 1, Data center characteristics as shown in Figure 3, DC Network characteristics as shown in Figure 4 and Energy consumption details as shows in Figure 5.

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

To modify the existing source code
The above sections shows the parameter changes in the existing network and to analyse the results. However, if a researcher is trying to configure a CPU, HPC Cluster, Cache Memory alteration, handling of Virtual Machines, etc, then there should be code modification in the source files (.cc and .h).
The location of these files are in the ~greencloud/build/ns-2.35/greencloud/ directory. Already these files are compiled as object files. Any changes to these files needs a compilation as specified below

if a file called cpu.cc is modified and have to be recompiled 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 a best open source tool that analyse the performance of a data center by varying parameters of the cloud and also gives a provision to add or modify existing source code to define new metrics for a cloud. Any questions on installation or tuning the GreenCloud are always welcome.


T S Pradeep Kumar

Popular posts from this blog

AWK Scripts for NS2 to process data from Trace Files


LEACH protocol installation in ns2 (ns-2.35)