Download as pdf or txt
Download as pdf or txt
You are on page 1of 65

LOAD BALANCER

A project submitted in partial fulfilment of


requirements for degree of
BACHELOR OF COMPUTER APPLICATION
(CLOUD COMPUTING & CYBERSECURITY)
BY
Vaibhav Bhatnagar
Roll No: 2166008098
Session: 2021-2024
Under the Supervision of
Dr. Tarun Vashishth
Associate Professor
School of Computer Science & Applications

IIMT UNIVERSITY
‘O’ Pocket, Ganga Nagar Colony,
Mawana Road, Meerut (U.P.), India
DECLARATION BY THE CANDIDATE

The Research work embodied in this project entitled


“LOAD BALANCER” has been carried out at the
“School of Computer Science & Applications, IIMT
University, Meerut, U.P.” The extent of information
derived from the existing literature has been
indicated in the body of the project at appropriate
places along with the source of information. The
work is original and has not been submitted in part
or for nay degree or diploma of this or any other
University.

Date: 10/05/2024 Vaibhav Bhatnagar


Place: Meerut Roll No: 2166008098
CERTIFICATE BY THE SUPERVISOR

This is to certify that the project report entitled


“LOAD BALANCER” submitted by Vaibhav
Bhatnagar in partial fulfilment of requirements for
degree of Bachelor of Computer Application at the
“School of Computer Science & Applications,
IIMT University, Meerut, U.P.” is a record of the
candidate own work carried out by him under my
supervision. The matter embodied in this project is
original and has not submitted for the award of any
other degree.

Dr. Tarun Vashishth


Associate Professor
IIMT University Meerut

Dr. Suraj Malik Mrs. Rachna Chaudhary


Dean HOD
IIMT University Meerut IIMT University Meerut
ACKNOWLEDGEMENT
I am greatly thankful to Dr. Suraj Malik, Dean School of
Computer Science & Applications IIMT University.
Meerut, U.P. India for providing necessary infrastructure
to carry out my project work at the university. I am
express my sincere thanks and gratitude to Ms. Rachna
Chaudhary, Head School of Computer Science &
Applications IIMT University. Meerut, U.P. India for her
moral support. valuable guidance and encouragement
during the various stages of my work.
I am feeling oblige in taking the opportunity to sincerely
thanks to Dr. Tarun Vashishth, Associate Professor
School of Computer Science & Applications IIMT
University. Meerut, U.P. India for his valuable guidance,
valuable advice and whole heartedly co-operation. His
sincerity, thoroughness, timely help, and constructive
criticism has been a constant source of inspiration for me.
I would also like to acknowledge my parents and friends
for the whole hearted moral support and unending
encouragement they provided me during my project
work.

Date: 10/05/2024 Vaibhav Bhatnagar


Place: Meerut Roll No: 2166008098
PLAGIARISM REPORT
CERTIFICATE OF PLAGIARISM CHECK

1 Name of Student/ Researchscholar Vaibhav Bhatnagar

2 Enrolment Number IIMTU/2166281

3 Department Name School of computer science and


applications

4 Subject Research Project

5 Category UG

6 Admission Year 2021

7 Title of the Dissertation/ Thesis Load Balancer

8 Name of the Supervisor/ Guide Dr. Tarun vasishtha

9 Acceptable Maximum Limit 15

10 % Similarity of content Identified 11

Used Software Drillbit / Turnitin Turnitin


11

12 Date of Verification 6/26/2024

Report on Plagiarism check, Item with % of similarity is attached.

Signature of the Student Signature of the Supervisor

Dean/Deputy Dean/Head of the Department


(Seal)

“O” Pocket, Ganga Nagar, Mawana Road, Meerut,


Contact no. 0121-2793500-506, Fax. 0121-2793600, Website: www.iimtu.com; Email:libiimtu@iimtindia.net
ABSTRACT

Cloud computing is a fast growing area in computing research and industry


today. Cloud computing enables a wide range of users to access distributed,
scalable, virtualized hardware and/or software infrastructure over the Internet.
With the advancement of the Cloud, there are new possibilities opening up on how
applications can be built and how different services can be offered to the end user
through Virtualization, on the internet. There are the cloud service providers who
provide large scaled computing infrastructure defined on usage, and provide the
infrastructure services in a very flexible manner which the users can scale up or
down at will.

Load balancing is a methodology to distribute workload across multiple


computers, or other resources over the network links to achieve optimal resource
utilization, maximize throughput, minimum response time, and avoid overload.
The establishment of an effective load balancing algorithm and how to use Cloud
computing resources efficiently for effective and efficient cloud computing is one
of the Cloud computing service providers‟ ultimate goals.

In this project a new VM load balancing algorithm has been proposed for an
IaaS framework in Simulated cloud computing environment; i.e. „Priority
Weighted Active Monitoring Load Balancing Algorithm‟ using CloudSim tools,
for the Datacenter to effectively load balance requests by prioritizing them and
assigning/allocating them between the available virtual machines assigning a
weight, in order to achieve better performance parameters such as response time
and Data processing time.

Keywords

Cloudsim, Virtualization, Virtual Machine, Cloudlets, Load Balancing


Chapter no Title Page no.
Abstract iv
List of tables viii
List of figures ix
1 INTRODUCTION 1
1.1 Introduction 1
1.2 Motivation 2
1.3 Objectives 2
1.4 Conclusion 3
2 CLOUD COMPUTING
2.1 Introduction 4
2.2 Cloud components 4
2.2.1 Clients 5
2.2.2 Datacenter 5
2.2.3 Distributed Servers 5
2.3 Type of clouds 5
2.4 Virtualization 6
2.4.1 Full Virtualization 6
2.4.2 Para Virtualization 7
2.5 Services provided by cloud computing 8
2.5.1 Software as a Service (SaaS) 8
2.5.2 Platform as a Service (PaaS) 9
2.5.3 Hardware as a Service (HaaS) 9
2.6 Simulation in cloud: CloudSim 10
2.6.1 Importance of simulation 11
2.6.2 Cloud Simulator 11
2.6.3 Modeling the cloud 14
2.6.4 Modeling the VM allocation 16
3 LOAD BALANCING 20
3.1 Introduction 20
3.2 Goals of Load Balancing 21
3.3 Types of Load Balancing Algorithms 21
3.4 Goals of Load Balancing Algorithms 22
3.5 Conclusion 22
4 VIRTUALIZATION 23
4.1 Introduction to virtualization 23
4.2 Modeling the VM allocation 23
4.3 Load Balancing Algorithms 25
4.3.1 Token Routing 25
4.3.2 Round Robin 25
4.3.3 Randomized 25
4.3.4 Central Queuing 26
4.3.5 Connection Mechanism 26
4.4 Metrics for Load Balancing 27
4.5 Contemporary VM Load Balancers 28
4.5.1 Round Robin Load Balancer 29
4.5.2 Throttled Load balancer 30
4.5.3 Active Monitoring Load Balancer 30
4.6 Conclusion 31
5 PROPOSED SYSTEM 32
5.1 Introduction 32
5.2 Priority weighted Load Balancing Algorithm 32
5.3 Conclusion 34
6 PROPOSED EXECUTION ENVIRONMENT 35
6.1 Introduction 35
6.2 Class diagram of components in CloudSim 35
6.3 Implementation 36
6.4 Steps in implementation 37
6.5 Conclusion 46
7 IMPLEMENTATION RESULTS 47
7.1 Introduction 47
7.2 Processing Cost 47
7.3 Response time 48
7.4 Average Response Time 49
7.5 Conclusion 50
8 REFERENCES 51
LIST OF TABLES

SL. NO TABLE NAME PAGE NO.


1 Comparison of load balancing algorithms 27
2 Datacenter parameters 36
3 Datacenter characteristics 36
4 Processing element characteristics 37
5 Comparison of Processing cost 47
6 Comparison of response time 48
7 Comparison of average response time 49
LIST OF FIGURES
SL.NO FIGURE PG NO
1 Internet 1
2 Cloud components 4
3 Full virtualization 6
4 Para virtualization 7
5 SaaS 8
6 PaaS 9
7 IaaS 10
8 Cloudsim architecture 12
9 VM Provisioning policies 17
10 Round robin load balancer 30
11 Class diagram of cloudsim components 35
12 Chart for processing cost 47
13 Chart for average processing cost 48
14 Chart for response time 49
15 Chart for average response time 49
1. INTRODUCTION
1.1 INTRODUCTION
Cloud computing is an on demand service in which shared resources,
information, software and other devices are provided according to the clients
requirement at specific time. It is a term which is generally used in case of Internet.
The whole Internet can be viewed as a cloud. Capital and operational costs can be
cut using cloud computing.

Figure 1: A cloud is used in network diagrams to depict the Internet.


Load balancing in cloud computing systems is really a challenge now. Always a
distributed solution is required. Because it is not always practically feasible or cost
efficient to maintain one or more idle services just as to fulfill the required
demands. Jobs can‟t be assigned to appropriate servers and clients individually for

1
efficient load balancing as cloud is a very complex structure and components are
present throughout a wide spread area. Here some uncertainty is attached while
jobs are assigned. This paper considers some of the methods of load balancing in
large scale Cloud systems. Our aim is to provide an evaluation and comparative
study of these approaches, demonstrating different distributed algorithms for load
balancing and to improve the different performance parameters like throughput,
latency etc. for the clouds of different sizes. As the whole Internet can be viewed
as a cloud of many connection-less and connection-oriented services, thus concept
of load balancing in Wireless sensor networks (WSN) can also be applied to cloud
computing systems as WSN is analogous to a cloud having no. of master
computers (Servers) and no. of slave computers (Clients) joined in a complex
structure.

1.2 MOTIVATION
Cloud computing is a vast concept. Many of the algorithms for load
balancing in cloud computing have been proposed. Some of those algorithms have
been overviewed in this project. The whole Internet can be considered as a cloud of
many connection-less and connection-oriented services. So the divisible load
scheduling theory for Wireless networks can also be applied for clouds. The
performance of various algorithms have been studied.

1.3 OBJECTIVES
1. To study the performance of some of the existing load balancing algorithms.

2. To design and develop a new VM load balancing algorithm by prioritizing tasks


and efficiently balancing load across virtual machines.

2
3. To evaluate the performance of the proposed scheme using CloudSim, an
abstract cloud computing environment using java language.

1.4 CONCLUSION
This chapter gives a brief idea about Cloud Computing and load balancing. It also
gives an overall idea about the objectives, motivation and organization of this
report.

3
2 CLOUD COMPUTING
2.1 INTRODUCTION
In case of Cloud computing services can be used from diverse and widespread
resources, rather than remote servers or local machines. There is no standard
definition of Cloud computing. Generally it consists of a bunch of distributed
servers known as masters, providing demanded services and resources to different
clients known as clients in a network with scalability and reliability of datacenter.
The distributed computers provide on-demand services. Services may be of
software resources (e.g. Software as a Service, SaaS) or physical resources (e.g.
Platform as a Service, PaaS) or hardware/infrastructure (e.g. Hardware as a
Service, HaaS or Infrastructure as a Service, IaaS ). Amazon EC2 (Amazon Elastic
Compute Cloud) is an example of cloud computing services.
2.2 CLOUD COMPONENTS
A Cloud system consists of 3 major components such as clients, datacenter, and
distributed servers. Each element has a definite purpose and plays a specific role.

Figure 2: Three components make up a cloud computing solution

4
2.2.1 Clients
End users interact with the clients to manage information related to the cloud.
Clients generally fall into three categories as given in [1]:
_ Mobile: Windows Mobile Smartphone, smartphones, like a Blackberry, or an
iPhone.
_ Thin: They don‟t do any computation work. They only dispaly the information.
Servers do all the works for them. Thin clients don‟t have any internal memory.
_ Thick: These use different browsers like IE or mozilla Firefox or Google Chrome
to connect to the Internet cloud.
2.2.2 Datacenter
Datacenter is nothing but a collection of servers hosting different applications. A
end user connects to the datacenter to subscribe different applications. A datacenter
may exist at a large distance from the clients. Now-a-days a concept called
virtualisation is used to install a software that allow multiple instances of virtual
server applications.
2.2.3 Distributed Servers
Distributed servers are the parts of a cloud which are present throughout the
Internet hosting different applications. But while using the application from the
cloud, the user will feel that he is using this application from its own machine.
2.3 TYPE OF CLOUDS
Based on the domain or environment in which clouds are used, clouds can be
divided into 3 categories :
_ Public Clouds
_ Private Clouds
_ Hybrid Clouds (combination of both private and public clouds)

5
2.4 VIRTUALIZATION
It is a very useful concept in context of cloud systems. Virtualization means
”something which isn‟t real”, but gives all the facilities of a real. It is the software
implementation of a computer which will execute different programs like a real
machine.
Virtualization is related to cloud, because using virtualization an end user can use
different services of a cloud. The remote datacenter will provide different services
in a fully or partial virtualized manner.
2 types of virtualization are found in case of clouds as given in [1] :
_ Full virtualization
_ Para virtualization
2.4.1 Full Virtualization
In case of full virtualization a complete installation of one machine is done on
another machine. It will result in a virtual machine which will have all the
software‟s that are present in the actual server.

Figure 3: Full Virtualization (adopted from [1]).


Here the remote datacenter delivers the services in a fully virtualized manner. Full
virtualization has been successful for several purposes as pointed out in [1]:
 Sharing a computer system among multiple users
 Isolating users from each other and from the control program
 Emulating hardware on another machine

6
2.4.2 Para virtualization
In para vitualization, the hardware allows multiple operating systems to run on
single machine by efficient use of system resources such as memory and processor.
e.g. VMware software. Here all the services are not fully available, rather the
services are provided partially.

Figure 4: Paravirtualization (adopted from [1]).


Paravirtualization has the following advantages as given in [1]:
 Disaster recovery: In the event of a system failure, guest instances are
moved to another hardware until the machine is repaired or replaced.
 Migration: As the hardware can be replaced easily, hence migrating or
moving the different parts of a new machine is faster and easier.
 Capacity management: In a virtalised environment, it is easier and faster to
add more hard drive capacity and processing power. As the system parts or
hardwares can be moved or replaced or repaired easily, capacity
management is simple and easier.

7
2.5 SERVICES PROVIDED BY CLOUD COMPUTING
Service means different types of applications provided by different servers across
the cloud. It is generally given as ”as a service”. Services in a cloud are of 3 types
as given in [1] :
 Software as a Service (SaaS)
 Platform as a Service (PaaS)
 Hardware as a Service (HaaS) or Infrastructure as a Service (IaaS)
2.5.1 Software as a Service (SaaS)
In SaaS, the user uses different software applications from different servers
through the Internet. The user uses the software as it is without any change and do
not need to make lots of changes or doen‟t require integration to other systems.
The provider does all the upgrades and patching while keeping the infrastructure
running.

Figure 5: Software as a service (SaaS)


The client will have to pay for the time he uses the software. The software that
does a simple task without any need to interact with other systems makes it an
ideal candidate for Software as a Service. Customer who isn‟t inclined to perform
software development but needs high-powered applications can also be benefitted
from SaaS. Some of these applications include (taken from [1]):

8
 Customer resource management (CRM)
 Video conferencing
 IT service management
 Accounting
2.5.2 Platform as a Service (PaaS)
PaaS provides all the resources that are required for building applications
and services completely from the Internet, without downloading or installing a
software. PaaS services are software design, development, testing, deployment,
and hosting. Other services can be team collaboration, database integration, web
service integration, data security, storage and versioning etc.

Figure 6: Platform as a service (PaaS) (adopted from [1])


Downfall :
 Lack of portability among different providers.
 If the service provider is out of business, the user‟s applications, data will be
lost.
2.5.3 Hardware as a Service (HaaS)
It is also known as Infrastructure as a Service (IaaS). It offers the hardware as a
service to a organisation so that it can put anything into the hardware according to
its will. HaaS allows the user to “rent” resources (taken from [1]) as

9
 Server space
 Network equipment
 Memory
 CPU cycles
 Storage space

Figure 7: Hardware as a service (HaaS)


Cloud computing provides a Service Oriented Architecture (SOA) and Internet
of Services (IoS) type applications, including fault tolerance, high scalability,
availability, flexibility, reduced information technology overhead for the user,
reduced cost of ownership, on demand services etc. Central to these issues lies the
establishment of an effective load balancing algorithm.
2.6 SIMULATION IN CLOUD : CLOUDSIM
Resources and software are shared on the basis of client‟s demand in cloud
environment. Essentially, dynamic utilization of resources is achieved under
different conditions with various previous established policies. Sometime it is very
much difficult and time consuming to measure performance of the applications in
real cloud environment. In this consequence, simulation is very much helpful to
allow users or developers with practical feedback in spite of having real
environment.

10
This section portrays the importance of simulation technique and simulation in
cloud. In this project, simulation is carried out with a specific cloud simulator,
CloudSim [2].
2.6.1 Importance of simulation technique:
Simulation means mimicking the actual environment towards benefit of the
research. The user or researcher can actually analyze the proposed design or
existing algorithms through simulation. They can check the efficiency and merit of
the design before the actual system is constructed.
Simulation is advantageous to the users, as they can explore the benefit of
that design repeatedly. This actually reduces the cost of reconstruct as changes
have been made during design time. Simulation technique provides lots of
advantages as the experiments can be carried out with voluminous data in different
abstraction level. Simulators easily make available various kind of virtual
environment for verification and performance evaluation of the experimented
system. Even most of the time researchers could carry out benchmark experiments
repeatedly in scalable environment for evaluating different aspects.
2.6.2 Cloud Simulator- CloudSim
Users are capable of accessing shared resources through utilizing available
public cloud platform. However, accessing real cloud environment or public cloud
is not always handy. Instead of the real environment, cloud simulator could
facilitate the experiments. Simulation environment allows customers or users to
tune the performance bottlenecks or evaluates different kinds of features under
varying load distributions[2]. Different kinds of functionalities of CloudSim are
presented in the following [3].
• support for modeling and simulation of large scale cloud computing data centers
• support for modeling and simulation of virtualized server hosts, with
customizable policies for provisioning host resources to virtual machines

11
• support for modeling and simulation of energy-aware computational resources
• support for modeling and simulation of datacenter network topologies and
message-passing applications
• support for modeling and simulation of federated clouds
• support for dynamic insertion of simulation elements, stop and resume of
simulation
• support for user-defined policies for allocation of hosts to virtual machines and
policies for allocation of host resources to virtual machines
Besides these above-mentioned functionalities, while developers or researchers,
uses CloudSim features, need not to think about the lower level details of cloud
based infrastructure and services.
The architecture of CloudSim comprises of four layers, as shown in Figure 7.

User code
Simulation
Specification
Cloud
Scenario
User
Requirements
… Application
Configuration

Scheduling
Policy User or Data Center Broker

CloudSim
User Virtual
Cloudlet
Interface Machine
Structures
VM Cloudlet VM
Services Execution Management

VM CPU Memory Storage Bandwidth


Cloud Provisioning Allocation Allocation Allocation Allocation
Services
Events Cloud
Sensor Data Center
Cloud Handling Coordinator
Resources
Network Message delay
Topology Calculation
Network

CloudSim core simulation engine

Fig 8. CloudSim architecture

12
At the bottom most layer, cloud resources (hosts, datacenters) are managed.
During the simulation period, these core entities are instantiated and executed. On
top of this layer, cloud services, like allocation of CPU, memory, storage and
bandwidth are provided as dedicated management interfaces. Another two top most
layers are virtual machine services and user interface structures. Virtual machine
in user interface structures layer is responsible for physical host specifications
such as number of machines and their configurations. CloudSim facilitates a
specific host to be concurrently shared among different VMs based on user-defined
QoS specifications [3]. This chapter gives a general idea about the basic concepts
of cloud computing along with the services provided by cloud computing systems.
In addition to that, a brief description of these components and the working
relationship between them is presented in the following:
Datacenter: Datacenter encompasses a number of hosts in homogeneous or
heterogeneous configurations (memory, cores, capacity, and storage). It also
creates the bandwidth, memory, and storage devices allocation.
Virtual Machine (VM): VM characteristics comprise of memory, processor,
storage, and VM scheduling policy. Multiple VM can run on single hosts
simultaneously and maintain processor sharing policies.
Host: This experiment considers VM need to handle a number of cores to be
processed and host should have resource allocation policy to distribute them in
these VMs. So host can arrange sufficient memory and bandwidth to the process
elements to execute them inside VM. Host is also responsible for creation and
destruction of VMs.
Cloudlet: Cloudlet is an application component which is responsible to deliver the
data in the cloud service model. So the length, and output file sizes parameter of
Cloudlet should be greater than or equal to 1. It also contains various ids for data
transfer and application hosting policy.

13
2.6.3 Modeling the Cloud

The infrastructure-level services (IaaS) related to the clouds can be


simulated by extending the Datacenter entity of CloudSim. The Data Center entity
manages a number of host entities. The hosts are assigned to one or more VMs
based on a VM allocation policy that should be defined by the Cloud service
provider. Here, the VM policy stands for the operations control policies related to
VM life cycle such as: provisioning of a host to a VM, VM creation, VM
destruction, and VM migration. Similarly, one or more application services can be
provisioned within a single VM instance, referred to as application provisioning in
the context of Cloud computing. In the context of CloudSim, an entity is an
instance of a component. A CloudSim component can be a class (abstract or
complete), or set of classes that represent one CloudSim model (data center, host).
A Datacenter can manage several hosts that in turn manage VMs during
their life cycles. Host is a CloudSim component that represents a physical
computing server in a Cloud: it is assigned a pre-configured processing capability
(expressed in millions of instructions per second – MIPS), memory, storage, and a
provisioning policy for allocating processing cores to virtual machines. The Host
component implements interfaces that support modeling and simulation of both
single-core and multi-core nodes.
VM allocation (provisioning) [9] is the process of creating VM instances on
hosts that match the critical characteristics (storage, memory), configurations
(software environment), and requirements (availability zone) of the SaaS provider.
CloudSim supports the development of custom application service models that can
be deployed within a VM instance and its users are required to extend the core
Cloudlet object for implementing their application services. Furthermore,
CloudSim does not enforce any limitation on the service models or provisioning

14
techniques that developers want to implement and perform tests with. Once an
application service is defined and modeled, it is assigned to one or more pre-
instantiated VMs through a service specific allocation policy. Allocation of
application-specific VMs to Hosts in a Cloud-based data center is the responsibility
of a Virtual Machine Allocation controller component (called
VmAllocationPolicy). This component exposes a number of custom methods for
researchers and developers that aid in implementation of new policies based on
optimization goals (user centric, system centric or both). By default,
VmAllocationPolicy implements a straightforward policy that allocates VMs to the
Host in First-Come-First-Serve (FCFS) basis. Hardware requirements such as the
number of processing cores, memory and storage form the basis for such
provisioning. Other policies, including the ones likely to be expressed by Cloud
providers, can also be easily simulated and modeled in CloudSim. However,
policies used by public Cloud providers (Amazon EC2, Microsoft Azure) are not
publicly available, and thus a pre-implemented version of these algorithms is not
provided with CloudSim.
For each Host component, the allocation of processing cores to VMs is done
based on a host allocation policy. This policy takes into account several hardware
characteristics such as number of CPU cores, CPU share, and amount of memory
(physical and secondary) that are allocated to a given VM instance. Hence,
CloudSim supports several simulation scenarios that assign specific CPU cores to
specific VMs (a space-shared policy) or dynamically distribute the capacity of a
core among VMs (time-shared policy); and assign cores to VMs on demand.
(check this sentence).
Each Host component also instantiates a VM scheduler component, which
can either implement the space-shared or the time-shared policy for allocating
cores to VMs. Cloud system/application developers and researchers, can further

15
extend the VM scheduler component for experimenting with custom allocation
policies. In the next section, the finer level details related to the time-shared and
space-shared policies are described. Fundamental software and hardware
configuration parameters related to VMs are defined in the VM class. Currently, it
supports modeling of several VM configurations offered by Cloud providers such
as the Amazon EC2.

2.6.4 Modeling the VM Allocation


One of the key aspects that make a Cloud computing infrastructure different
from a Grid computing infrastructure is the massive deployment of virtualization
tools and technologies. Hence, as against Grids, Clouds contain an extra layer (the
virtualization layer) that acts as an execution, management, and hosting
environment for application services. Hence, traditional application provisioning
models that assign individual application elements to computing nodes do not
accurately represent the computational abstraction, which is commonly associated
with Cloud resources. For example, consider a Cloud host that has a single
processing core, there is a requirement of concurrently instantiating two VMs on
that host. Even though in practice VMs are contextually (physical and secondary
memory space) isolated, still they need to share the processing cores and system
bus.
Hence, the amount of hardware resources available to each VM is
constrained by the total processing power and system bandwidth available within
the host. This critical factor must be considered during the VM provisioning
process, to avoid creation of a VM that demands more processing power than is
available within the host. In order to allow simulation of different provisioning
policies under varying levels of performance isolation, CloudSim supports VM
provisioning at two levels: first, at the host level and second, at the VM level. At

16
the host level, it is possible to specify how much of the overall processing power of
each core will be assigned to each VM. At the VM level, the VM assigns a fixed
amount of the available processing power to the individual application services
(task units) that are hosted within its execution engine. For the purpose of this
paper, we consider a task unit as a finer abstraction of an application service being
hosted in the VM.
At each level, CloudSim implements the time-shared and space-shared
provisioning policies. To clearly illustrate the difference between these policies
and their effect on the application service performance, in Figure 4 we show a
simple VM provisioning scenario. In this figure, a host with two CPU cores
receives request for hosting two VMs, such that each one requires two cores and
plans to host four tasks units. More specifically, tasks t1, t2, t3 and t4 to be hosted
in VM1, while t5, t6, t7, and t8 to be hosted in VM2.

(a) (b)

(c) (d)

Figure 9. Effects of different provisioning policies on task unit execution: (a) Space-shared
provisioning for VMs and tasks, (b) Space-shared provisioning for VMs and time-shared
provisioning for tasks, (c) Time-shared provisioning for VMs, space-shared provisioning for
tasks, and (d) Time-shared provisioning for VMs and tasks.

Figure 9(a) presents a provisioning scenario, where the space-shared policy


is applied for both VMs and task units. As each VM requires two cores, in space-
shared mode only one VM can run at a given instance of time. Therefore, VM2 can

17
only be assigned the core once VM1 finishes the execution of task units. The same
happens for provisioning tasks within the VM1: since each task unit demands only
one core, therefore both of them can run simultaneously. During this period
remaining tasks (2 and 3) wait in the execution queue. By using a space-shared
policy, the estimated finish time of a task p managed by a VM i is given by:
eft(p)=est + 𝑟𝑙
𝑐𝑎𝑝𝑎𝑐𝑖𝑡𝑦 𝑥 𝑐𝑜𝑟𝑒𝑠(𝑝)

where est(p) is the Cloudlet (cloud task) estimated start time and rl is the total
number of instructions that the Cloudlet will need to execute on a processor. The
estimated start time depends on the position of the Cloudlet in the execution queue,
because the processing unit is used exclusively (space-shared mode) by the
Cloudlet. Cloudlets are put in the queue when there are free processing cores
available that can be assigned to the VM. In this policy, the total capacity of a host
having np processing elements is given by:
𝑐𝑎𝑝(𝑖)
capacity=∑𝑛𝑝
𝑖=1 𝑛𝑝

where cap(i) is processing strength of individual elements.

In Figure 9(b), a space-shared policy is applied for allocating VMs to hosts


and a time-shared policy forms the basis for allocating task units to processing core
within a VM. Hence, during a VM lifetime, all the tasks assigned to it are
dynamically context switched during their lifecycle. By using a time-shared policy,
the estimated finish time of a Cloudlet managed by a VM is given by
𝑟𝑙
Eft(p)=𝑐𝑡 +
𝑐𝑎𝑝𝑎𝑐𝑖𝑡𝑦 𝑥 𝑐𝑜𝑟𝑒𝑠(𝑝)

where eft(p) is the estimated finish time, ct is the current simulation time, and
cores(p) is the number of cores (processing elements) required by the Cloudlet. In

18
time-shared mode, multiple Cloudlets (task units) can simultaneously multi-task
within a VM. In this case, we compute the total processing capacity of Cloud host
as
∑𝑛𝑝 𝑐𝑎𝑝(𝑖)
capacity= 𝑖=1
𝑐𝑙𝑜𝑢𝑑𝑙𝑒𝑡𝑠
max(∑j=1 𝑐𝑜𝑟𝑒𝑠(j),𝑛𝑝)

where cap(i) is processing strength of individual elements.

In Figure 9(c), a time-shared provisioning is used for VMs, while task units
are provisioned based on a space-shared policy. In this case, each VM receives a
time slice on each processing core, which then distributes the slices among task
units on a space-shared basis. As the cores are shared, the amount of processing
power available to a VM is variable. This is determined calculating VMs that are
active on a host. As the task units are assigned based on a space-shared policy,
which means that at any given instance of time only one task can be actively using
the processing core.
Finally, in Figure 9(d) a time-shared allocation is applied for both VMs and
task units. Hence, the processing power is concurrently shared by the VMs and the
shares of each VM are simultaneously divided among its task units. In this case,
there are no queuing delays associated with task units.
CONCLUSION:
In this chapter the basics of Cloud computing, virtualization, simulation
techniques and a java based cloud simulator CloudSim was discussed. The way in
which CloudSim models the cloud and Virtual Machines and different policies for
scheduling is studied.

19
3 LOAD BALANCING
3.1 INTRODUCTION
It is a process of reassigning the total load to the individual nodes of the
collective system to make resource utilization effective and to improve the
response time of the job, simultaneously removing a condition in which some of
the nodes are over loaded while some others are under loaded. A load balancing
algorithm which is dynamic in nature does not consider the previous state or
behavior of the system, that is, it depends on the present behavior of the system.
The important things to consider while developing such algorithm are:
 estimation of load,
 comparison of load,
 stability of different system,
 performance of system,
 interaction between the nodes,
 nature of work to be transferred,
 selecting of nodes and many other ones.
This load considered can be in terms of CPU load, amount of memory used, delay
or Network load.

Load balancing in cloud computing is the process of distributing the load among
various resources in any system. Thus load need to be distributed over the
resources in cloud-based architecture, so that each resources does approximately
the equal amount of task at any point of time. Basic need is to provide some
techniques to balance requests to provide the solution of the application faster.

20
Cloud vendors are based on automatic load balancing services, which allow clients
to increase the number of CPUs or memories for their resources to scale with
increased demands. This service is optional and depends on the clients business
needs. So load balancing serves two important needs, primarily to promote
availability of Cloud resources and secondarily to promote performance.

3.2 GOALS OF LOAD BALANCING


The goals of load balancing are:
 To improve the performance substantially
 To have a backup plan in case the system fails even partially
 To maintain the system stability
 To accommodate future modification in the system

3.3 TYPES OF LOAD BALANCING ALGORITHMS


Depending on who initiated the process, load balancing algorithms can be of three
Categories:
 Sender Initiated: If the load balancing algorithm is initialised by the sender
 Receiver Initiated: If the load balancing algorithm is initiated by the receiver
 Symmetric: It is the combination of both sender initiated and receiver
initiated
Depending on the current state of the system, load balancing algorithms can be
divided into 2 categories:
 Static: It does not depend on the current state of the system. Prior knowledge
of the system is needed
 Dynamic: Decisions on load balancing are based on current state of the
system. No prior knowledge is needed. So it is better than static approach.

21
There are also other load balancing mechanisms like
 Centralized load balancing
 De-centralized load balancing
 Periodic load balancing
 Non-Periodic load balancing.
3.4 GOALS OF LOAD BALANCING ALGORITHMS:
 Cost effectiveness: primary aim is to achieve an overall improvement in
system performance at a reasonable cost.
 Scalability and flexibility: the distributed system in which the algorithm is
implemented may change in size or topology. So the algorithm must be
scalable and flexible enough to allow such changes to be handled easily.
 Priority: prioritization of the resources or jobs need to be done on before
hand through the algorithm itself for better service to the important or high
prioritized jobs in spite of equal service provision for all the jobs regardless
of their origin.
3.5 CONCLUSION
This chapter explains the concept of load balancing, types of load balancing
algorithms, general idea about load balancing algorithms and the different policies
that can be used in it.

22
4. VIRTUALIZATION
4.1 INTRODUCTION TO VIRTUALIZATION:
The virtualization forms the foundation of cloud technology where
Virtualization is an emerging IT paradigm that separates computing functions and
technology implementations from physical hardware. Cloud computing, for
example, is the Virtualization of computer programs through an internet
connection rather than installing applications on every office computer.
Using virtualization, users can access servers or storage without knowing specific
server or storage details. The virtualization layer will execute user request for
computing resources by accessing appropriate resources.
Virtualization can be applied to many types of computer resources:
Infrastructure such as Storage, Network, Compute (CPU / Memory etc.), Platform
(such as Linux/ Windows OS) and Software as Services.
Cloud computing in computing research and industry today has the potential
to make the new idea of „computing as a utility‟ in the near future. The Internet is
often represented as a cloud and the term “Cloud Computing”. Cloud computing is
the dynamic provisioning of IT capabilities/IT services (hardware, software, or
services) from third parties over a network. These IT services are delivered on
demand and they are delivered elastically, in terms of „able to scale out‟ and „scale
in‟. The sections below briefly details different types of cloud computing and how
Virtual Machines (VMs) can be provided as cloud Infrastructure as a Service(Iaas).

4.2 MODELING THE VM ALLOCATION

Cloud computing infrastructure is the massive deployment of virtualization


tools and techniques as it has an extra layer i.e. Virtualization layer that acts as an

23
creation, execution, management, and hosting environment for application
services.
The modeled VMs in the above virtual environment are contextually isolated
but still they need to share computing resources- processing cores, system bus etc.
Hence, the amount of hardware resources available to each VM is constrained by
the total processing power ie. CPU, the memory and system bandwidth available
within the host. The choice of virtual machine, meaning that you can select a
configuration of CPU, memory, storage, bandwidth etc. that is optimal for an
application.
CloudSim supports VM provisioning at two levels:-
 At the host level – It is possible to specify how much of the overall
processing power of each core will be assigned to each VM. Known as VM
policy Allocation
 At the VM level – the VM assigns a fixed amount of the available
processing power to the individual application services (task units) that are
hosted within its execution engine. Known as VM Scheduling.

Note that at each level CloudSim implements the time-shared and space-shared
provisioning policies. In this project, we have implemented the VM load Balancing
algorithm at the VM level and a comparison is made between time-shared and
space-shared provisioning policies, where, individual application services is
assigned varying (different) amount of the available processing power of VMs
based on priority of task units. This is because- in the real world, it‟s not necessary
all the VMs in a DataCenter has fixed amount of processing powers but it can vary
with different computing nodes at different ends.
And then to these VMs of different processing powers, the tasks/requests
(application services) based on priority are assigned or allocated to the most

24
powerful VM and then to the lowest and so on. Hence, the performance parameters
such as overall response time and data processing time are optimized.
4.3 SOME LOAD BALANCING ALGORITHMS:
Brief reviews of few existing load balancing algorithms are presented in the
following:
4.3.1 Token Routing:
The main objective of the algorithm is to minimize the system cost by
moving the tokens around the system. But in a scalable cloud system agents cannot
have the enough information of distributing the work load due to communication
bottleneck. So the workload distribution among the agents is not fixed. The
drawback of the token routing algorithm can be removed with the help of heuristic
approach of token based load balancing. This algorithm provides the fast and
efficient routing decision. In this algorithm agent does not need to have an idea of
the complete knowledge of their global state and neighbor‟s working load. To
make their decision where to pass the token they actually build their own
knowledge base. This knowledge base is actually derived from the previously
received tokens. So in this approach no communication overhead is generated.
4.3.2. Round Robin:
In round robin algorithm, the processes are divided between all processors.
Each process is assigned to the processor in a round robin order. The process
allocation order is maintained locally independent of the allocations from remote
processors. Though the work load distributions between processors are equal but
the job processing time for different processes are not same. So at any point of
time some nodes may be heavily loaded and others remain idle. This algorithm is
mostly used in web servers where Http requests are of similar nature and
distributed equally.

25
4.3.3. Randomized:
Randomized algorithm is of type static in nature. In this algorithm a process
can be handled by a particular node n with a probability p. The process allocation
order is maintained for each processor independent of allocation from remote
processor. This algorithm works well in case of processes are of equal loaded.
However, problem arises when loads are of different computational complexities.
Randomized algorithm does not maintain deterministic approach. It works well
when Round Robin algorithm generates overhead for process queue.
4.3.4. Central queuing:
Central queuing algorithm works on the principal of dynamic distribution.
Each new activity arriving at the queue manager is inserted into the queue. When
request for an activity is received by the queue manager it removes the first activity
from the queue and sends it to the requester. If no ready activity is present in the
queue the request is buffered, until a new activity is available. But in case new
activity comes to the queue while there are unanswered requests in the queue the
first such request is removed from the queue and new activity is assigned to it.
When a processor load falls under the threshold then the local load manager sends
a request for the new activity to the central load manager. The central manager
then answers the request if ready activity is found otherwise queues the request
until new activity arrives.
4.3.5. Connection mechanism:
Load balancing algorithm can also be based on least connection mechanism
which is a part of dynamic scheduling algorithm. It needs to count the number of
connections for each server dynamically to estimate the load. The load balancer
records the connection number of each server. The number of connection
increases when a new connection is dispatched to it, and decreases the number
when connection finishes or timeout happens.

26
Table 1 presents a comparative study of the above-mentioned load balancing
algorithms:

Algorithm Nature Environment Process Resource Steadiness


migration migration Utilization

Token Routing dynamic decentralized possible more unstable


Round Robin static decentralized not possible Less stable
Randomized static decentralized not possible Less stable
Central Queuing dynamic centralized not possible Less unstable
Least Connection dynamic centralized not possible Less stable
Table 1: Comparative Study of Load Balancing Algorithms
4.4. METRICS FOR LOAD BALANCING IN CLOUDS:

The existing load balancing techniques in clouds, consider various


parameters like performance, response time, scalability, throughput, resource
utilization, fault tolerance, migration time and associated overhead. But, for an
energy-efficient load balancing, metrics like energy consumption and carbon
emission should also be considered.

• Overhead Associated - determines the amount of overhead involved while


implementing a load-balancing algorithm. It is composed of overhead due to
movement of tasks, inter-processor and inter-process communication. This should
be minimized so that a load balancing technique can work efficiently.
• Throughput - is used to calculate the no. of tasks whose execution has been
completed. It should be high to improve the performance of the system.
• Performance – is used to check the efficiency of the system. It has to be
improved at a reasonable cost e.g. reduce response time while keeping acceptable
delays.

27
• Resource Utilization - is used to check the utilization of resources. It should be
optimized for an efficient load balancing.
• Scalability - is the ability of an algorithm to perform load balancing for a system
with any finite number of nodes. This metric should be improved.
• Response Time - is the amount of time taken to respond by a particular load
balancing algorithm in a distributed system. This parameter should be minimized.
• Fault Tolerance - is the ability of an algorithm to perform uniform load balancing
in spite of arbitrary node or link failure. The load balancing should be a good
fault-tolerant technique.
• Migration time - is the time to migrate the jobs or resources from one node to
other. It should be minimized in order to enhance the performance of the system.
• Energy Consumption (EC) - determines the energy consumption of all the
resources in the system. Load balancing helps in avoiding overheating by
balancing the workload across all the nodes of a Cloud, hence reducing energy
consumption.
• Carbon Emission (CE) - calculates the carbon emission of all the resources in the
system. As energy consumption and carbon emission go hand in hand, the more the
energy consumed, higher is the carbon footprint. So, for an energy-efficient load
balancing solution, it should be reduced.

4.5 CONTEMPORARY VM LOAD BALANCERS


Virtual machine enables the abstraction of an OS and Application running
on it from the hardware. The interior hardware infrastructure services interrelated
to the Clouds is modeled in the Cloudsim simulator by a Datacenter element for
handling service requests. These requests are application elements sandboxed
within VMs, which need to be allocated a share of processing power on
Datacenter‟s host components. DataCenter object manages the data center

28
management activities such as VM creation and destruction and does the routing of
user requests received from User Bases via the Internet to the VMs. The Data
Center Controller, uses a VmLoadBalancer to determine which VM should be
assigned the next request for processing. The contemporary Vmloadbalancer are
Round Robin, throttled and active monitoring load balancing algorithms.
4.5.1. Round Robin Load Balancer (RRLB)
The datacenter controller assigns the requests to a list of VMs on a rotating
basis. The first request is allocated to a VM- picked randomly from the group and
then the DataCenter controller assigns the subsequent requests in a circular order.
Once the VM is assigned the request, the VM is moved to the end of the list.

In this RRLB; there is a better allocation concept known as Weighted


Round Robin Allocation in which one can assign a weight to each VM so that if
one VM is capable of handling twice as much load as the other, the powerful
server gets a weight of 2. In such cases, the DataCenter Controller will assign two
requests to the powerful VM for each request assigned to a weaker one.

The major issue in this allocation is this that it does not consider the
advanced load balancing requirements such as processing times for each individual
requests.

29
Fig 10: Round Robin Load Balancer

4.4.2. Throttled Load Balancer (TLB)


The TLB maintains a record of the state of each virtual machine (busy/idle).
If a request arrived concerning the allocation of virtual machine, the TLB sends the
ID of ideal virtual machine to the data center controller and data center controller
allocates the ideal virtual machine.

4.4.3. Active Monitoring Load Balancer (AMLB)


The AMLB maintains information about each VMs and the number of
requests currently allocated to which VM. When a request to allocate a new VM
arrives, it identifies the least loaded VM. If there are more than one, the first

30
identified is selected. ActiveVmLoadBalancer returns the VM id to the Data
Center Controller. The data Center Controller sends the request to the VM
identified by that id. DataCenterController notifies the ActiveVmLoadBalancer of
the new allocation and cloudlet is sent to it.
4.5 CONCLUSION
This chapter focuses on virtualization, an overview of virtual machines and
how CloudSim supports Load balancing algorithms. Contemporary load balancing
algorithms are also introduced to get a clear idea about the proposed system.

31
5. PROPOSED SYSTEM
5.1 INTRODUCTION
The „Priority Weighted Load Balancing Algorithm‟ is implemented;
modifying the Active Monitoring Load Balancer by assigning a weight to each VM
as discussed in Weighted Round Robin Algorithm of cloud computing and
providing priority to requests in order to achieve better response time and
processing time. In this proposed Load balancing algorithm using the concept of
weights in active monitoring, the VM are assigned varying (different) amount of
the available processing power of server/ physical host to the individual application
services and also applying priority to requests provide better performance. To these
VMs of different processing powers; the tasks/requests (application services) are
prioritized and assigned or allocated to the most powerful VM and then to the
lowest and so on according to its weight and its availability. Hence optimizing the
given performance parameters.

5.2 PRIORITY WEIGHTED LOAD BALANCING ALGORITHM

(Algorithm)
STEP 1: Create VM‟s of different Datacenter according to computing power of
host/physical server in terms of its core processor, processing speed, memory,
storage etc.
STEP 2: Allocate weighted count according to the computing power of the VM‟s
in Datacenter. If one VM is capable of having twice as much load as the other, the
powerful server gets a weight of „2‟ or if it can take four times load then server
gets a weight of „4‟ and so on.
For example:
A. Host server with single core processor, 1GB of memory, 1TB of Storage space,
1000000 bandwidth will have weighted count=1

32
B. Host server with 2 core processor, 4GB of memory, 2TB of Storage space and
1000000 bandwidth will have weighted count=2
C. Host server with quard core processor, 8GB of memory 4TB of Storage space
and 1000000 bandwidth will have weighted count=4 and so on..
STEP 3: PriorityWeightedActiveVmLoadBalancer maintains an index table of
VMs, associated weighted count and the number of requests currently allocated to
the VM. At start all VM's have 0 allocations.
STEP 4: The requests are prioritized based on the applications from which they
arrive from.
STEP 5: When a request to allocate a new VM from the DataCenterController
arrives, it gets the priority of the request and then parses the table to find the most
powerful VM. If there are more than one, then the one which is least loaded is
selected.
STEP 6: PriorityWeightedActiveVmLoadBalancer returns the VM id to the
DataCenterController.
STEP 7: The DataCenterController sends the request to the VM identified by that
id.
STEP 8: DataCenterController notifies the Priority Weighted Active Vm Load
Balancer of the new allocation.
STEP9: PriorityWeightedActiveVmLoadBalancer updates the allocation table
increasing the allocations count for that VM.
STEP 10: When the VM finishes processing the request, and the
DataCenterController receives the response cloudlet, it notifies the
PriorityWeightedActiveVmLoadBalancer of the VM de-allocation.
STEP 11:The Priority Weighted Active Vm Load Balancer updates the allocation
table by decreasing the allocation count for the VM by one.
STEP 12: Continue from step 5.
33
The purpose of algorithm is to find the expected Response Time of each Virtual
Machine because virtual machine are of heterogeneous capacity with regard to its
processing performance, the expected response time can be found with the help of
the following formulas:
Response Time = Fint - Arrt + TDelay (1)
Where, Arrt is the arrival time of user request and Fint is the finish time of user
request and the transmission delay can be determined by using the following
formulas:
TDelay = T + T(2)latencytransfer
Where, TDelay is the transmission delay Tlatency is the network latency and T
transfer is the time taken to transfer the size of data of a single request (D) from
source location to destination.
Ttransfer = D / Bwperuser (3)
Bwperuser = Bwtotal / Nr (4)
Where, Bwtotal is the total available bandwidth and Nr is the number of user
requests currently in transmission. The Internet Characteristics also keeps track of
the number of user requests in-flight between two regions for the value of Nr.

5.3 CONCLUSION
In this chapter, our new algorithm for load balancing has been proposed. The
various formulas to calculate response time, delay and processing time are defined.

34
6. PROPOSED EXECUTION ENVIRONMENT
6.1 INTRODUCTION
This chapter discusses about implementing the proposed environment in
CloudSim, a java based cloud simulator. The components of the simulator,
implementation, coding and comparisons will be discussed in the next sections of
this chapter.
6.2 CLASS DIAGRAM OF COMPONENTS OF CLOUDSIM

Fig 11: Class diagram of CloudSim components

35
6.3 IMPLEMENTATION
The proposed algorithm is implemented through simulation package
CloudSim based tool [7][10][11]. Java language is used for develop and implement
the new „Priority Weighted VM load balancing Algorithm‟. Assuming that the
applications are deployed in 3 datacenters having 2 virtual machines each running
on 6 physical hosts, then the parameter values are as follows:
Parameter Value
Datacenter OS Linux
Datacenter Architecture X86
Service Broker Policy Optimize response time
Physical hardware units(hosts) 6
No. of VM‟s 6
Table 2 : Datacenter Parameters
The datacenter characteristics of the three datacenters are as follows:
Characteristics Datacenter 1 Datacenter 2 Datacenter 3
Cost* 5.0 3.0 4.0
CostPerMem# 0.5 0.3 0.4
CostPerStorage$ 0.05 0.05 0.04
costPerBw** 0.0 0.0 0.0
Table 3: Datacenter Characteristics
* The cost of using processing in this resource
# The cost of using memory in this resource
$ The cost of using storage in this resource
** The cost of using bw in this resource

36
The detail of the processing element in each host is given below:
No of processors Processor speed(MIPS) VM policy
1 900 Space-shared
2 2000 Space- shared
Table 4: Processing element characteristics

6.4 STEPS IN IMPLEMENTING THE ALGORITHM IN CLOUDSIM:


The following are the steps to implement the algorithm in CloudSim.
6.4.1 First step: Initialize the CloudSim package. It should be called before
creating any entities.
int num_user = 1; // number of cloud users
Calendar calendar = Calendar.getInstance();
boolean trace_flag = false; // mean trace events

Initialize the GridSim library


CloudSim.init(num_user, calendar, trace_flag);
6.4.2 Second step: Create Datacenters. Datacenters are theCreate resource
providers in CloudSim. We need at list one of them to run a CloudSim simulation.
We are creating 3 datacenters in the above given specification.
Datacenter datacenter0 = createDatacenter("Datacenter_0");
Datacenter datacenter1 = createDatacenter("Datacenter_1");
Datacenter datacenter2 = createDatacenter("Datacenter_2");
Method implementing specifications to create Datacenter.
private static Datacenter createDatacenter(String name){
// Here are the steps needed to create a PowerDatacenter:
// 1. We need to create a list to store our machine
List<Host> hostList = new ArrayList<Host>();

37
// 2. A Machine contains one or more PEs or CPUs/Cores.
List<Pe> peList = new ArrayList<Pe>();
List<Pe> peList1 = new ArrayList<Pe>();
int mips = 1000;
// 3. Create PEs and add these into a list.
peList.add(new Pe(0, new PeProvisionerSimple(900)));
peList1.add(new Pe(0, new PeProvisionerSimple(mips)));
peList1.add(new Pe(1, new PeProvisionerSimple(mips)));
//4. Create Host with its id and list of PEs and add them to the list of machines
int hostId=0;
int ram = 1024*2; //host memory (MB)
long storage = 1000000; //host storage
int bw = 100000;
//in this example, the VMAllocatonPolicy in use is SpaceShared. It means that
//only one VM is allowed to run on each Pe.
hostList.add(
new Host( hostId,
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList,
new VmSchedulerSpaceShared(peList))
); // This is our first machine
hostId++;
hostList.add(
new Host(
hostId,

38
new RamProvisionerSimple(ram),
new BwProvisionerSimple(bw),
storage,
peList1,
new VmSchedulerSpaceShared(peList))
);

// 5. Create a DatacenterCharacteristics object that stores the properties of a


//data center: architecture, OS, list of Machines, allocation policy: time- or
//space-shared, time zone and its price (G$/Pe time unit).
String arch = "x86"; // system architecture
String os = "Linux"; // operating system
String vmm = "Xen";
double time_zone = 10.0; // time zone this resource located
double cost = 3.0; // the cost of using processing in this resource
double costPerMem = 0.05; // the cost of using memory in this resource
double costPerStorage = 0.001; // the cost of using storage in this resource
double costPerBw = 0.0; // the cost of using bw in this resource
LinkedList<Storage> storageList = new LinkedList<Storage>();
DatacenterCharacteristics characteristics = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, 5.0, 0.5,0.05, costPerBw);
DatacenterCharacteristics characteristics1 = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, 3.0, 0.3,0.05, costPerBw);
DatacenterCharacteristics characteristics2 = new DatacenterCharacteristics(
arch, os, vmm, hostList, time_zone, 4.0, 0.4,0.04, costPerBw);

39
// 6. Finally, we need to create a PowerDatacenter object.
Datacenter datacenter = null;
try {
if(name == "Datacenter_0")
datacenter = new Datacenter(name, characteristics, new
VmAllocationPolicySimple(hostList), storageList, 0);
else if (name== "Datacenter_1")
datacenter = new Datacenter(name, characteristics1, new
VmAllocationPolicySimple(hostList), storageList, 0);
else
datacenter = new Datacenter(name, characteristics2, new
VmAllocationPolicySimple(hostList), storageList, 0);
}
catch (Exception e) {e.printStackTrace();}
return datacenter;
}
6.4.3 Third step: Create Broker. DatacenterBroker represents a broker acting on
behalf of a user. It hides VM management, as vm creation, sumbission of cloudlets
to this VMs and destruction of VMs.

DatacenterBroker broker = createBroker();


int brokerId = broker.getId();

40
Method to create datacenterBroker
private static DatacenterBroker createBroker(){

DatacenterBroker broker = null;


try {
broker = new DatacenterBroker("Broker");
} catch (Exception e) {
e.printStackTrace();
return null;
}
return broker;
}
6.4.4 Fourth step: Create Virtual machines
Vm represents a VM: it runs inside a Host, sharing hostList with other VMs. It
processes cloudlets. This processing happens according to a policy, defined by the
CloudletScheduler. Each VM has a owner, which can submit cloudlets to the VM
to be executed
vmlist = new ArrayList<Vm>();
//VM description
int vmid = 0;
int mips = 250;
long size = 100000; //image size (MB)
int ram = 512; //vm memory (MB)
long bw = 1000;
int pesNumber = 1; //number of cpus
String vmm = "Xen"; //VMM name

41
//create any number of VMs
Vm vm1 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerSpaceShared());

//the second VM will have twice the priority of VM1 and so will receive twice
//CPU time and so on
vmid++;

Vm vm2 = new Vm(vmid, brokerId, mips, pesNumber, ram, bw, size, vmm, new
CloudletSchedulerSpaceShared());
.
.
.
//add the VMs to the vmList
vmlist.add(vm1);
vmlist.add(vm2);
//submit vm list to the broker
broker.submitVmList(vmlist);
6.4.5 Fifth step: Create two CloudletLists. Each list can contain any number of
cloudlets of different lengths. Submit the lists to the broker.
cloudletList1 = new ArrayList<Cloudlet>();
cloudletList2 = new ArrayList<Cloudlet>();
cloudletList1 = createCloudlet(brokerId, 10, 0); // creating 10 cloudlets
cloudletList2 = createCloudlet1(brokerId, 10, 0); // creating 10 cloudlets
//submit cloudlet list to the broker
broker.submitCloudletList(cloudletList1);
broker.submitCloudletList(cloudletList2)

42
METHOD TO CREATE CLOUDLETS FOR LIST1
private static List<Cloudlet> createCloudlet(int userId, int cloudlets, int idShift){
// Creates a container to store Cloudlets
LinkedList<Cloudlet> list1 = new LinkedList<Cloudlet>();

//cloudlet parameters
long length = 40000;
long fileSize = 300;
long outputSize = 300;
int pesNumber = 1;
UtilizationModel utilizationModel = new UtilizationModelFull();
Cloudlet[] cloudlet = new Cloudlet[cloudlets];
for(int i=0;i<cloudlets;i++){
cloudlet[i] = new Cloudlet(idShift + i, length, pesNumber, fileSize,
outputSize, utilizationModel, utilizationModel, utilizationModel);
// setting the owner of these Cloudlets
cloudlet[i].setUserId(userId);
list1.add(cloudlet[i]);
length+=1000;
}
return list1;
}

43
METHOD TO CREATE CLOUDLETS FOR LIST2
private static List<Cloudlet> createCloudlet1(int userId, int cloudlets, int idShift){
// Creates a container to store Cloudlets
LinkedList<Cloudlet> list2 = new LinkedList<Cloudlet>();
//cloudlet parameters
long length = 35000;
long fileSize = 300;
long outputSize = 300;
int pesNumber = 1;
UtilizationModel utilizationModel = new UtilizationModelFull();
Cloudlet[] cloudlet = new Cloudlet[cloudlets];
for(int i=0;i<cloudlets;i++){
cloudlet[i] = new Cloudlet(idShift + i, length, pesNumber, fileSize, outputSize,
utilizationModel, utilizationModel, utilizationModel);
// setting the owner of these Cloudlets
cloudlet[i].setUserId(userId);
list2.add(cloudlet[i]);
length+=2000;
}
return list2;
}
6.4.6 Submitting cloudlets to the broker: Cloudlets are submitted to the broker
priority wise. This way, the broker will submit the bound cloudlets only to the
specific VM.

The coding for prioritizing List1 is as follows


Cloudlet cloudlet;

44
for (int i = 0; i <cloudletList1.size(); i++)
{
cloudlet = cloudletList1.get(i);
if(cloudlet.getCloudletLength()<46000)
broker.bindCloudletToVm(cloudlet.getCloudletId(),vm1.getId());
else
broker.bindCloudletToVm(cloudlet.getCloudletId(),vm2.getId());
}

The coding for prioritizing List2 is as follows

Cloudlet cloudletx;

for (int j=0; j <cloudletList2.size(); j++)

cloudletx = cloudletList2.get(j);
if(cloudletx.getCloudletLength()<46000)
broker.bindCloudletToVm(cloudletx.getCloudletId(),vm1.getId());
else
broker.bindCloudletToVm(cloudletx.getCloudletId(),vm2.getId());

45
6.4.7 Sixth step: Start simulation
CloudSim.startSimulation();
6.4.8 Final step: Print results when simulation is over
List<Cloudlet> newList = broker.getCloudletReceivedList();
CloudSim.stopSimulation();
printCloudletList(newList);
//Print the debt of each user to each datacenter
datacenter0.printDebts();
datacenter1.printDebts();
datacenter2.printDebts();

Debt= Ram of VM*CostPerRam+ Size of VM*CostPerStorage;

6.5 CONCLUSION
Thus the proposed algorithm is implemented using cloudsim. The results
of the implementation is discussed in the next chapter.

46
7. IMPLEMENTATION RESULTS
7.1 INTRODUCTION:
The results of implementation are divided into 3 categories,
 Processing cost
 Response Time
 Average Response Time.
7.2 PROCESSING COST:
The processing cost of the whole algorithm depends on the data center debts.
Datacenter debts of the existing system and proposed system are compared in the
following table and a chart is drawn.
Datacenter Existing System Debts Proposed System Debts
1 10256 10512
2 10256 10307.2
3 10256 8409.6
AVERAGE 10256 9742.933
Table 5: Comparison of Processing cost

12000

10000

8000

6000
Debt(Exis)
4000
Debt(Prop)
2000
0
1
2
3

Fig 12: Chart for processing cost

47
10300
10200
10100
10000
9900 Series1
9800
9700
9600
9500
9400
Av. Debt(Exis) Av. Debt(Prop)

Fig 13: Chart for average processing cost


7.3 RESPONSE TIME
Table 6: Comparison of response time
Cloudlet Id‟s time(exis) time(prop)
0 160 160
1 164 164
2 156 168
3 172 172
4 176 204.6
5 180 214.29
6 184 184
7 188 188
8 202 192
9 196 196
0 140 700
1 1057.12 370
2 1176.17 156
3 164 164
4 1195.22 176
5 1223.79 180
6 188 820
7 1257.12 430
8 1252.36 204
9 212 212

48
1400

1200

1000

800
time(exis)
600 time(prop)

400

200

0
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20

Fig 14: Chart for response time


7.4 AVERAGE RESPONSE TIME
EXISTING SYSTEM PROPOSED SYSTEM

482.189 262.7445

Table 7: Comparison of average response time

500
450
400
350
300
Series1
250
200
150
100
50
0
Existing system Proposed System

Fig 15: Chart for average response time

49
7.5 CONCLUSION
Thus the proposed system „priority weighted active monitoring load
balancer‟ is found to be efficient in terms of Processing cost, response time and
average response time.
Load balancing is becoming an area of increased interest and with the
proposed algorithm we have optimized processing time and cost.

50
REFERENCES
[1] Anthony T.Velte, Toby J.Velte, Robert Elsenpeter, Cloud Computing A
Practical Approach, TATA McGRAW-HILL Edition 2010.

[2] CloudSim: A Framework for Modeling and Simulation of Cloud Computing


Infrastructures and Services, The Cloud Computing and Distributed Systems
(CLOUDS) Laboratory, University of Melbourne, (2011) available from:
http://www.cloudbus.org/cloudsim/

[3] Calheiros Rodrigo N., Rajiv Ranjan, César A. F. De Rose, Rajkumar Buyya
(2009): CloudSim: A Novel Framework for Modeling and Simulation of Cloud
Computing Infrastructures and Services CoRR abs/0903.2525: (2009)

[4] Ali M. Alakeel, A Guide to Dynamic Load Balancing in Distributed Computer


Systems, IJCSNS International Journal of Computer Science and Network
Security, VOL.10 No.6, June 2010.

[5] Rodrigo N. Calheiros, Rajiv Ranjan, Anton Beloglazov, Cesar A. F. De Rose,


and Rajkumar Buyya, CloudSim: A Toolkit for Modeling and Simulation of Cloud
Computing Environments and Evaluation of Resource Provisioning Algorithms,
Software: Practice and Experience (SPE), Volume 41, Number 1, Pages: 23-50,
ISSN: 0038-0644, Wiley Press, New York, USA, January, 2011

[6] Rajkumar Buyya, Rajiv Ranjan and Rodrigo N. Calheiros,; Modeling and
Simulation of Scalable Cloud Computing Environments and the CloudSim Toolkit:
Challenges and Opportunities. Proceedings of the 7th High Performance

51
Computing and Simulation Conference (HPCS 2009, ISBN: 978-1-4244-4907-1,
IEEE Press, New York, USA), Leipzig, Germany, June 21-24, 2009.

[7] EFFICIENT VM LOAD BALANCING ALGORITHM FOR A CLOUD


COMPUTING ENVIRONMENT Jasmin James et al. / International Journal on
Computer Science and Engineering (IJCSE)

[8] Bhathiya Wickremasinghe, Rodrigo N. Calheiros, Rajkumar


Buyya,“CloudAnalyst: A CloudSim-based Visual Modeller for Analysing
Cloud Computing Environments and Applications”, 20-23, April 2010, pp. 446-
452.

[9] A. Quiroz, H. Kim, M. Parashar, N. Gnanasambandam, and N. Sharma.


Towards Autonomic Workload Provisioning for Enterprise Grids and Clouds.
Proceedings of the 10th IEEE/ACM International Conference on Grid Computing
(Grid 2009), Banf, Alberta, Canada, October 13-15, 2009, IEEE Computer Society
Press.

52

You might also like