Module 3
Contents…
• VM lifecycle
• Process and system level VMs
• VM configurations
• VM migrations
• Migration types and process
• VM provisioning
• Scaling
• VM scheduling
• Load balancing: Significance
• Types and Algorithms
• Case study : KVM, KVM architecture, KVM commands
Virtualization
• Virtualization is the creation of a virtual -- rather than actual --
version of something, such as an operating system (OS), a server,
a storage device or network resources.
• Virtualization uses software that simulates hardware
functionality in order to create a virtual system. This practice
allows IT organizations to operate multiple operating systems,
more than one virtual system and various applications on a
single server. The benefits of virtualization include greater
efficiencies and economies of scale.
Virtual Machine
• A virtual machine, commonly shortened to just VM, is no
different than any other physical computer like a laptop, smart
phone, or server. It has a CPU, memory, disks to store your files,
and can connect to the internet if needed. While the parts that
make up your computer (called hardware) are physical and
tangible, VMs are often thought of as virtual computers or
software-defined computers within physical servers, existing
only as code.
VM lifecycle
• The lifecycle of a virtual machine starts with the creation phase,
the configuration of the virtual machine and the allocation of
virtual resources, followed by the exploitation and monitoring
phase of the virtual machine (its use and status) and concluded
by the elimination phase of the virtual machine and the release
of virtual resources.
• Automating the management of VMs through
all aspects of the VM life cycle provides the
ability to use your physical resources in the
most efficient and productive manner.
• You create VMs as needed, put them under version control,
provision them as jobs e, and remove them from the system
when they are no longer needed.
The VM life cycle is divided into two parts:
Configuration and Deployment
Configuration is performed on a VM in the security of a
development environment which allows for creation, testing,
and modification of the VM until you are ready to launch the
VM into the production environment.
Deployment performed in the production environment and the
changes take place in real time.
Configuring VMs
Configuring VMs includes creating, storing, editing, and versioning.
These configurations are done in an environment removed from
your production environment.
These VMs do not affect your data center operations.
The configurations are done to prepare the VM for data center launch.
Any changes made after data center launch are done during the
deployment phase of the life cycle.
Inconfiguring virtual machines (VMs), you design, build, and test
your VMs before deploying them to your data center.
These actions do not directly impact your production environment.
ZENworks® Orchestrator (an advanced datacenter management solution
designed to manage all network resources) Server has an additional
Virtual Machine Management (VM Management) interface console to aid
you in developing and testing your VMs before listing them as
deployable resources in your Orchestrator Console.
Create:
ZENworks Virtual Machine Builder (VM Builder) is used to
create new Xen* VMs.
You simply define the parameters of the VM you need and the
VM is automatically created to your specifications.
Discover:
The Orchestrator Server discovers VMs that exist in your
enterprise.
In order to be available as a resource for jobs, the VM must
have the ZENworks Orchestrator Agent installed on it.
These can be VMs you have just created or VMs that you have
already been using in your enterprise.
Check-in:
Both created and discovered VMs can be checked into the
ZENworks Virtual Machine Warehouse.
When VMs are checked in, version control is implemented. You
can decide to not check VMs in and these will not receive
version control.
Edit:
You check VMs out from the VM Warehouse to edit their
configuration or operating system image. W
hen you check the edited VM back into the VM Warehouse, the
edited VM has its version number incremented.
When you have two or more VMs, the designation of Gold
Master version is used to identify the approved version. The
Gold Master version is the version of the VM that launches
when deployed by the Orchestrator Server.
The Gold Master versions are also listed in the Orchestrator
Console under the Repository and VM headings in the tree.
Deploying VMs
When deploying VMs, you designate management of the VMs
that are under version control, tested, and ready for
deployment.
These include further developmental changes to the VM,
changes made because of QA testing, or changes required
after launching the VM into your datacenter’s production
environment.
Deploy:
Deployment operations are performed through ZENworks
Orchestrator. When a VM is ready for your production
environment, you can list either a started VM or a VM
Template as a resource.
These VMs, as stated before, must have the Orchestrator Agent
installed on them before they become resources.
The ZENworks Orchestrator deploys a VM when it is needed to
run a job just as it uses physical machines to meet the resource
needs of a job. When a VM template is deployed, the template is
cloned into a VM and then deployed. The cloned VM is
destroyed when the job releases it.
Monitor:
The ZENworks Monitoring Service, which is included as
another perspective with VM Management, monitors every
aspect of your VMs, including their performance, status, and
availability.
This service also monitors the host machines on which your
VMs are deployed and can be extended to any physical machine
in your network.
Manage:
While your VMs are deployed you can manage any step of the
life cycle of the VM according to your criteria.
You can manage the process of cloning, overall properties of the
VM, and you can use provisioning adapters to manage the
location of the VM within your VM Host environment.
You can also patch deployed VMs or send them to a directory
for image editing. If a VM Host fails or experiences performance
issues, the Orchestrator Server transfers the active, running
VM to another server with barely a perceptible pause in the
speed and continuity of the transfer of data.
Destroy:
At the end of its usefulness, you can destroy the VM, which
removes it from its listing in the ZENworks Orchestrator
Console.
To completely destroy the VM, you also need to delete its stored
image in the VM Warehouse. For information on destroying
VMs.
Process and system level VMs
• The two basic types of virtual machines are process and system
VMs. A process virtual machine allows you to run a single
process as an application on a host machine. A system virtual
machine is a fully virtualized VM designed to be a substitute for
a physical machine.
• A system virtual machine provides a complete system platform
which supports the execution of a complete operating system
(OS). In contrast, a process virtual machine is designed to run a
single program, which means that it supports a single process.
• Virtual hosts are able to share resources between multiple guests, or
virtual machines, each with their own operating system instance. The
two basic types of virtual machines are process and system VMs.
• A process virtual machine allows you to run a single process as an
application on a host machine. An example of a process virtual
machine is the Java Virtual Machine (JVM) which allows any system
to run Java applications as if they were native to the system.
• A system virtual machine is a fully virtualized VM designed to be a
substitute for a physical machine. It runs on a different host machine
by utilizing a hypervisor such as VMware ESXi to access the
underlying machine’s resources.
• A Process virtual machine, sometimes called an application
virtual machine, runs as a normal application inside a host OS
and supports a single process. It is created when that process is
started and destroyed when it exits. Its purpose is to provide a
platform-independent programming environment that abstracts
away details of the underlying hardware or operating system,
and allows a program to execute in the same way on any
platform. For example Wine software in Linux helps to run
Windows application.
• A System virtual machine provides a complete system platform
which supports the execution of a complete operating system
(OS),Just like you said VirtualBox is one example.
• A System Virtual Machine is also called as Hardware Virtual Machine.
It is the software emulation of a computer system. It mimics the entire
computer.
• It is an environment that allows multiple instances of the operating
system (virtual machines) to run on a host system, sharing the
physical resources.
• Examples of System VMs software
[Link]
[Link]
[Link] Virtual PC
[Link]
[Link]
[Link] Xen
• The advantage of using System VM are:
Multiple Operating System environments can run in parallel on
the same piece of hardware in strong isolation from each other.
The VM can provide an instruction set architecture (ISA) that
is slightly different from that of the real machine.
• The main draw backs are:
Since the VM indirectly accesses the same hardware the
efficiency is compromised.
Multiply VMs running in parallel on the same physical
machine may result in varied performance depending on the
workload imposed on the system. Implementing proper isolation
techniques may address this drawback.
• A Process Virtual Machine is also called a Language Virtual
Machine or an Application Virtual Machine or Managed Runtime
Environment.
• Examples of Process VMs
• JVM (Java Virtual Machine) is used for the Java language
• PVM (Parrot Virtual Machine) is used for Perl Language
• CLR (Common Language Runtime) is used for .NET
Framework
•
Process and system level VMs
VM configurations
• Virtual machine configuration is the arrangement of resources
assigned to a virtual machine. The resources allocated to a
virtual machine (VM) typically include allocated processors,
memory, disks, network adapters and the user interface.
Configuration refers to both the specific elements included and
the way those elements are set up.
• Virtual machines can be created quickly and easily but the
default configuration settings may not be the best ones for VM
performance. Each VM should be configured with only the
resources it needs. For example, if a particular VM doesn't need a
CD-ROM drive or a floppy drive, removing those items will
improve VM functioning.
What Does Virtual Machine Configuration Mean?
Virtual machine configuration is the process of creating and assigning
hardware, software, network, and peripheral devices, and other
resources to a virtual machine.
Virtual machine configuration is done automatically through the
hypervisor or manually by the administrator whenever a new virtual
machine is created.
Virtual machine configuration primarily defines the overall
operational specification of a virtual machine. Generally, virtual
machine configuration is designed to meet the underlying
requirements and capacity of the host physical machine. It is
assigned with justifiable resources that can be scaled on run time by
the hypervisor. Virtual machine configuration attributes include but
are not limited to:
• CPU allocation and settings
• Memory allocation and settings
• Storage allocation and settings
• Peripheral device settings ( CD-ROM, floppy, etc.)
• Boot order settings
• Communication adapter and ports settings ( serial port, parallel
port, USB, network adapter, etc.)
• System startup and shutdown
• Other administrative settings
VM provisioning
• Virtual machine provisioning, or virtual server provisioning, is a
systems management process that creates a new virtual machine
(VM) on a physical host server and allocates computing resources
to support the VM.
• Helps in simplification of Server Provisioning and Resource
allocation management.
• Server provisioning is defining server’s configuration based on
the user requirements.
H/W – CPU, RAM, Storage, Networking etc:
OS
Application
VM provisioning
Analogy for Virtual Machine Provisioning:
• Historically, when there is a need to install a new server for a
certain workload to provide a particular service for a client, lots
of effort was exerted by the IT administrator, and much time was
spent to install and provision a new server.
1) Check the inventory for a new machine,
2) get one,
3) format, install OS required,
4) and install services; a server is needed along with lots of
security batches and appliances.
• Now, with the emergence of virtualization technology and the
cloud computing IaaS model:
It is just a matter of minutes to achieve the same task. All you
need is to provision a virtual server through a self-service
interface with small steps to get what you desire with the
required specifications.
1) provisioning this machine in a public cloud like Amazon
Elastic Compute Cloud (EC2), or
2) using a virtualization management software package or a
private cloud management solution installed at your data
center in order to provision the virtual machine inside the
organization and within the private cloud setup.
Virtual Machine Provisioning and Manageability
Virtual Machine Life Cycle
• The cycle starts by a request delivered to the IT department,
stating the requirement for creating a new server for a particular
service.
• This request is being processed by the IT administration to start
seeing the servers’ resource pool, matching these resources with
requirements.
• Starting the provision of the needed virtual machine.
• Once it provisioned and started, it is ready to provide the required
service according to an SLA (Service Level Agreement).
• Virtual is being released; and free resources.
VM provisioning
VM Provisioning Process
The common and normal steps of provisioning a virtual server are
as follows:
• Firstly, you need to select a server from a pool of available servers
(physical servers with enough capacity) along with the appropriate
OS template you need to provision the virtual machine.
• Secondly, you need to load the appropriate software (operating
System you selected in the previous step, device drivers,
middleware, and the needed applications for the service required).
• Thirdly, you need to customize and configure the machine (e.g., IP
address, Gateway) to configure an associated network and storage
resources.
• Finally, the virtual server is ready to start with its newly loaded
software.
VM Provisioning Process
• To summarize, server provisioning is defining server’s
configuration based on the organization requirements, a
hardware, and software component (processor, RAM, storage,
networking, operating system, applications, etc.).
• Normally, virtual machines can be provisioned by manually
installing an operating system, by using a preconfigured VM
template, by cloning an existing VM, or by importing a physical
server or a virtual server from another hosting platform. Physical
servers can also be virtualized and provisioned using P2V
(Physical to Virtual) tools and techniques (e.g., virtp2v).
VM Provisioning Process
• After creating a virtual machine by virtualizing a physical server,
or by building a new virtual server in the virtual environment, a
template can be created out of it.
• Most virtualization management vendors (VMware, XenServer,
etc.) provide the data center’s administration with the ability to
do such tasks in an easy way.
VIRTUAL MACHINE MIGRATION
• Virtual machine migration is the task of moving a virtual
machine from one physical hardware environment to another.
Virtual machine migration is also known as teleportation.
• Previously, whenever there was a need for performing a
server’s upgrade or performing maintenance tasks, you would
exert a lot of time and effort, because it is an expensive
operation to maintain or upgrade a main server that has lots of
applications and users.
• Now, with the advance of the revolutionized virtualization
technology and migration services associated with hypervisors’
capabilities, these tasks (maintenance, upgrades, patches, etc.)
are very easy and need no time to accomplish.
Need
Upgrading
Balancing resource usage
VM failures
Meet SLA
• Provisioning a new virtual machine is a matter of minutes,
saving lots of time and effort, Migrations of a virtual machine is a
matter of milliseconds:
1) saving time
2) effort
3) making the service alive for customers
4) achieving the SLA/SLO agreements and quality-of-service
(QoS) specifications required.
VIRTUAL MACHINE MIGRATION SERVICES
Live Migration and High Availability
• Live migration (which is also called hot or real-time migration)
can be defined as the movement of a virtual machine from one
physical host to another while being powered on. When it is
properly carried out, this process takes place without any
noticeable effect from the end user’s point of view (a matter of
milliseconds).
• One of the most significant advantages of live migration is the
fact that it facilitates proactive maintenance in case of failure,
because the potential problem can be resolved before the
disruption of service occurs.
• Live migration can also be used for load balancing in which work
is shared among computers in order to optimize the utilization of
available CPU resources.
VIRTUAL MACHINE MIGRATION SERVICES
Live Migration Anatomy, Xen Hypervisor Algorithm.
• How to live migration’s mechanism and memory and virtual
machine states are being transferred, through the network,
from one host A to another host B:
• The Xen hypervisor is an example for this mechanism. The
logical steps that are executed when migrating an OS.
• In this research, the migration process has been viewed as a
transactional interaction between the two hosts involved:
Live Migration Timeline
Live Migration Stages
• Stage 0:
Pre-Migration stage – A target host will be preselected where the
resources required to receive migration will be guaranteed.
• Stage 1:
Reservation – A request is submitted to migrate a VM from Host-
A to Host-B. If the request is not fulfilled, then VM will continue
to run on Host-A.
• Stage 2:
Repetitive Pre-Copy: During the first iteration, all memory pages
are transferred from Host-A to Host-B. Subsequent iterations
copy are only those pages dirtied during the previous transfer.
• Stage 3:
Stop (suspend)-and-Copy: In this phase, VM will be suspended
on Host-A and redirect its network traffic to Host-B. CPU state
and any remaining inconsistent memory pages are then
transferred like a final sync. This process will reach a consistent
suspended copy of the VM at both Host-A and Host-B. Host-A
will remain primary and it will be resumed in case of failure at
this stage.
• Stage 4:
Commitment to the hosts: Host-B sends the signal to Host-A
that it has successfully received a consistent VM OS image.
Host-A acknowledges the signal and destroys the VM. Host-B
becomes the primary host for migrated VM.
• Stage 5:
Activation of VM: The migrated VM on Host-B is now
activated. Post-migration code connects to the local resources
and resumes the operation.
• This approach to failure management ensures that at least on
host has a consistent VM image at all times during migration:
1) Original host remains stable until migration commits and
that the VM may be suspended and resumed on that host with
no risk of failure.
2) A migration request essentially attempts to move the VM to a
new host and on any sort of failure, execution is resumed
locally, aborting the migration.
Live Migration Vendor Implementations
Example
• There are lots of VM management and provisioning tools that provide the live
migration of VM facility, two of which are VMware VMotion and Citrix
XenServer “XenMotion”.
• VMware VMotion:
a) Automatically optimize and allocate an entire pool of resources for
maximum hardware utilization, flexibility, and availability.
b) Perform hardware’s maintenance without scheduled downtime along with
migrating virtual machines away from failing or underperforming servers.
Citrix XenServer “XenMotion”:
Based on Xen live migrate utility, it provides the IT Administrator the facility to
move a running VM from one XenServer to another in the same pool without
interrupting the service (hypothetically zero – downtime server maintenance),
making it a highly available service and also good feature to balance workloads
on the virtualized environments
Regular/Cold Migration
Cold migration is the migration of a powered-off virtual machine. With cold migration:
• You have options of moving the associated disks from one data store to another.
• The virtual machines are not required to be on a shared storage.
1) Live migrations needs to a shared storage for virtual machines in the server’s pool,
but cold migration does not.
2) In live migration for a virtual machine between two hosts, there should be certain
CPU compatibility checks, but in cold migration this checks do not apply.
• Cold migration (VMware product ) is easy to implement and is
summarized as follows:
The configuration files, including NVRAM file (BIOS Setting),
log files, and the disks of the virtual machines, are moved from
the source host to the destination host’s associated storage area.
The virtual machine is registered with the new host.
After the migration is completed, the old version of the virtual
machine is deleted from the source host.
Live Storage Migration of Virtual Machines
• This kind of migration constitutes moving the virtual disks or
configuration file of a running virtual machine to a new data
store without any interruption in the availability of the
virtual machine’s service.
Scaling
• In cloud computing, scaling is the process of adding or removing
compute, storage, and network services to meet the demands a
workload makes for resources in order to maintain availability
and performance as utilization increases.
• One of the biggest benefits of cloud computing is that it can
be elastic. Like a rubber band, the idea behind elastic computing
is that you can stretch or shrink your cloud service usage to
accommodate changes in workload.
• Virtual Machine Scaling, an interesting service offered by cloud
computing, helps to create and manage a set of identical, auto-
scaling Virtual Machines (VMs). The number of VM instances can
automatically increase or decrease based on scheduled conditions.
Auto-Scaling
• Auto-scaling is a way to automatically scale up or down the
number of compute resources that are being allocated to your
application based on its needs at any given time.
• The key point is that you can now design a scalable architecture
that will automatically scale-up or scale-down to meet your needs
over the lifetime of your setup regardless of how fast/slow or
big/small your site grows over that time.
• Here are the most popular ways of autoscaling:
• Horizontal Scaling
• Vertical Scaling
Vertical Scaling:
• Vertical Scaling is an attempt to increase or decrease the
capacity of a single machine, also called scaling up or down. Here
the resources such as processing power, storage, memory, and
more are added to an existing work unit.
• It is done to increase the capacity of existing hardware or
software by adding resources. It can enhance your server without
manipulating your code. But it is limited by the fact that you can
only get as big as the size of the server.
• For example, you could move an application to a larger VM size.
Horizontal Scaling:
• Horizontal Scaling is a must use technology – whenever a high
availability of (server) services are required, also called scaling
out and in, means adding or removing instances of a resource.
Scaling horizontally involves adding more processing units or
physical machines to your server or database.
• It involves growing the number of nodes in the cluster, the
application continues running without interruption as new
resources are provisioned.
• If demand drops, the additional resources can be shut down
cleanly and deallocated.
Load balancing: Significance
• Load balancing is the process of distributing network traffic
across multiple servers. This ensures no single server bears too
much demand. By spreading the work evenly, load balancing
improves application responsiveness. It also increases
availability of applications and websites for users.
• As the name suggests, load balancing is a process in which the
workload is distributed to achieve better efficiency. The ultimate
aim here is to optimize the use of all resources available while
minimizing response time as much as possible.
• A load balancer can be deployed as software or hardware to a
device that distributes connections from clients between a set of
servers. A load balancer acts as a ‘reverse-proxy’ to represent the
application servers to the client through a virtual IP address
(VIP).
• Load balancers are used to provide availability and scalability to
the application. The application can scale beyond the capacity of
a single server. The load balancer works to steer the traffic to a
pool of available servers through various load balancing
algorithms. If more resources are needed, additional servers can
be added.
• Modern high-traffic websites must serve hundreds of thousands,
if not millions, of concurrent requests from users or clients and
return the correct text, images, video, or application data, all in a
fast and reliable manner. To cost-effectively scale to meet these
high volumes, modern computing best practice generally requires
adding more servers.
• A load balancer acts as the “traffic cop” sitting in front of your
servers and routing client requests across all servers capable of
fulfilling those requests in a manner that maximizes speed and
capacity utilization and ensures that no one server is
overworked, which could degrade performance.
• If a single server goes down, the load balancer redirects traffic to
the remaining online servers. When a new server is added to the
server group, the load balancer automatically starts to send
requests to it.
A load balancer performs the following functions:
Distributes client requests or network load efficiently across
multiple servers.
Ensures high availability and reliability by sending requests
only to servers that are online.
Provides the flexibility to add or subtract servers as demand
dictates.
Benefits of Load Balancing
Reduced downtime
Scalable
Redundancy
Flexibility
Efficiency
Types of Load Balancers – Based on
Functions
Several load balancing techniques are there for addressing
the specific network issues:
Network Load Balancer / Layer 4 (L4) Load Balancer:
Based on the network variables like IP address and
destination ports. Network Load balancing is the
distribution of traffic at the transport level through the
routing decisions. Such load balancing is TCP i.e. level 4,
and does not consider any parameter at the application
level like the type of content, cookie data, headers,
locations, application behavior etc.
Performing network addressing translations without
inspecting the content of discrete packets, Network Load
Balancing cares only about the network layer information
and directs the traffic on this basis only.
Application Load Balancer / Layer 7 (L7) Load Balancer:
Ranking highest in the OSI model, Layer 7 load balancer
distributes the requests based on multiple parameters at the
application level.
A much wider range of data is evaluated by the L7 load
balancer including the HTTP headers and SSL sessions and
distributes the server load based on the decision arising from a
combination of several variables.
This way application load balancers control the server traffic
based on the individual usage and behavior.
Global Server Load Balancer/Multi-site Load Balancer:
With the increasing number of applications being hosted in
cloud data centers, located at varied geographies, the GSLB
extends the capabilities of general L4 and L7 across various
data centers facilitating the efficient global load distribution,
without degrading the experience for end users.
In addition to the efficient traffic balancing, multi-site load
balancers also help in quick recovery and seamless business
operations, in case of server disaster or disaster at any data
center, as other data centers at any part of the world can be
used for business continuity.
Types of Load Balancers – Based on
Configurations
• Load Balancers are also classified as:
• Hardware Load Balancer: A hardware load balancer, as the
name implies, relies on physical, on-premises hardware to
distribute application and network traffic. These devices can
handle a large volume of traffic but often carry a hefty price tag
and are fairly limited in terms of flexibility.
• Software Load Balancer: A software load balancer comes in two
forms—commercial or open-source—and must be installed prior
to use. Like cloud-based balancers, these tend to be more
affordable than hardware solutions.
• Virtual Load Balancer: A virtual load balancer differs from
software load balancers because it deploys the software of a
hardware load balancing device on a virtual machine.
Load Balancing Algorithms
Round Robin
Round-robin load balancing is one of the simplest and most used load
balancing algorithms.
Client requests are distributed to application servers in rotation.
For example, if you have three application servers: the first
client request to the first application server in the list, the
second client request to the second application server, the
third client request to the third application server, the fourth
to the first application server and so on.
This load balancing algorithm does not take into consideration the
characteristics of the application servers.
i.e. it assumes that all application servers are the same with the same
availability, computing and load handling characteristics.
Weighted Round Robin
Weighted Round Robin builds on the simple Round-robin load
balancing algorithm to account for differing application server
characteristics.
The administrator assigns a weight to each application server
based on criteria of their choosing to demonstrate the
application servers traffic-handling capability.
If application server #1 is twice as powerful as application server #2 (and
application server #3), application server #1 is provisioned with a higher
weight and application server #2 and #3 get the same weight.
If there five (5) sequential client requests, the first two (2) go to
application server #1, the third (3) goes to application server #2, the fourth
(4) to application server #3 and the fifth (5) to application server #1.
Least Connection
Least Connection load balancing is a dynamic load balancing
algorithm where client requests are distributed to the
application server with the least number of active connections
at the time the client request is received.
In cases where application servers have similar specifications,
an application server may be overloaded due to longer lived
connections; this algorithm takes the active connection load into
consideration.
Weighted Least Connection
Weighted Least Connection builds on the Least Connection load
balancing algorithm to account for differing application server
characteristics.
The administrator assigns a weight to each application server
based on criteria of their choosing to demonstrate the
application servers traffic-handling capability.
The LoadMaster is making the load balancing criteria based on
active connections and application server weighting.
The weighted least connections algorithm maintains a weighted
list of application servers with their number of active
connections. The service forwards a new connection to a server
based on the following combination. This algorithm uses more
computation times than the least connection algorithm.
Resource Based (Adaptive)
Resource Based (Adaptive) is a load balancing algorithm
requires an agent to be installed on the application server that
reports on its current load to the load balancer.
The installed agent monitors the application servers availability
status and resources. The load balancer queries the output from
the agent to aid in load balancing decisions.
Fixed Weighting
Fixed Weighting is a load balancing algorithm where the
administrator assigns a weight to each application server based
on criteria of their choosing to demonstrate the application
servers traffic-handling capability.
The application server with the highest weigh will receive all of
the traffic. If the application server with the highest weight
fails, all traffic will be directed to the next highest weight
application server.
Weighted Response Time
Weighted Response Time is a load balancing algorithm where
the response times of the application servers determines which
application server receives the next request.
The application server response time to a health check is used
to calculate the application server weights. The application
server that is responding the fastest receives the next request.
Source IP Hash
Source IP hash load balancing algorithm that combines source
and destination IP addresses of the client and server to
generate a unique hash key.
The key is used to allocate the client to a particular server. As
the key can be regenerated if the session is broken, the client
request is directed to the same server it was using previously.
This is useful if it’s important that a client should connect to a
session that is still active after a disconnection.
VM scheduling
• Virtual Machine (VM) scheduling determines the way in which
Physical Machine (PM) resources are allocated in order to launch a
VM instance (a process called VM placement).
• Scheduling is a balancing scenario in which processes or tasks are
scheduled as per given requirements.
• It is a method that is used to distribute valuable computing
resources, usually processor time, bandwidth and memory, to the
various processes, threads, data flows and applications that need
them.
• Scheduling is done to balance the load on the system and ensure
equal distribution of resources and give some prioritization
according to set of rules. This ensures that a computer system is
able to serve all requests and achieve a certain quality of service.
• Virtual Machine (VM) scheduling algorithms are used to
schedule the VM requests to the Physical Machines (PM) of the
particular Data Center (DC) as per the requirement fulfilled with
the requested resources.
• A scheduler is the component of an operating system that decides
which CPU the various tasks should run on and for how long
they are allowed to do so.
• VM Scheduling determines how many processing cores of a host
are allocated to virtual machines and how many processing cores
will be delegated to each VM. It also determine how much of the
processing core’s capacity will effectively be attributed for a given
VM.
• A virtual machine is a logical implementation of a computer that
operates in the similar manner as the computer system. A cloud
computing environment requires a suitable algorithm for
executing the various jobs provided to the system in a cost
effective manner based on certain constraints.
• This task is performed by a VM scheduler using a suitable
scheduling algorithm.
• VM scheduling policy is implemented in two levels, namely Host
level and VM level.
At the host level, it is possible to specify how much of the overall
processing power of each core in a host will be assigned to each VM.
At the VM level, the Virtual Machines assign specific amount of the
available processing power to the individual task units that are
hosted within its execution engine.
• This happens when an OS runs on the bare hardware of a
physical host and it is also the case when the OS runs inside a
virtual machine. The only difference being that, in the latter
case, the OS scheduler marshals tasks among virtual CPUs.
VM SCHEDULING ALGORITHMS
• VM Scheduling determines how many processing cores of a host
are allocated to virtual machines and how many processing cores
will be delegated to each VM. It also determine how much of the
processing core’s capacity will effectively be attributed for a given
VM.
• There are different VM scheduling policies are there viz.
First-Come First-Serve(FCFS), Shortest Job First, Round Robin,
Genetic Algorithm etc.
• First- Come First- Serve VM Scheduling Algorithm
First-come First-serve (FCFS) scheduling algorithm in which
the process that requests the resource first is allocated first.
The implementation of the FCFS policy is easily managed with
a FIFO queue. When a process enters the ready queue, its PCB
is linked onto the tail of the queue.
When the CPU is free, it is allocated to the process at the head
of the queue. The running process is then removed from the
queue. The code for FCFS scheduling is simple to write and
understand.
The FCFS scheduling algorithm is non-preemptive. Once the
CPU has been allocated to a process, that process keeps the
CPU until it releases the CPU, either by terminating or by
requesting I/O.
The FCFS algorithm is thus particularly troublesome for time-
sharing systems, where it is important that each user get a
share of the CPU at regular intervals. It would be disastrous to
allow one process to keep the CPU for an extended period.
• Round Robin VM Scheduling Algorithm
The Round Robin algorithm focuses on distributing the load
equally to all the nodes. Using this algorithm, the Scheduler
allocates one VM to a node in a cyclic manner.
The round robin scheduling for VM scheduling is similar to the
round robin scheduling for process scheduling. The scheduler
starts assigning VM to each node and move further for next VM
to place in to next node. This algorithm is repeated for all the
nodes until each node have at least on VM. After placing VMs to
all nodes it will go to the first node and repeat this process for
next VMs requests. Hence, in this case, the scheduler does not
wait for the exhaustion of the resources of a node before moving
on to the next.
• Genetic VM Scheduling Algorithm
Genetic algorithm is for scheduling sets of independent VM’s,
the objective of genetic algorithm is to minimize the make span.
Initially in GA many individual solutions are (usually)
randomly generated to form an initial population. The
population size depends on the nature of the problem i.e. type
and no of VM’s to be run effectively on system. During each
successive generation, a proportion of the existing population is
selected to breed a new generation.
• In the present cloud computing environment, the scheduling
approaches for VM (Virtual Machine) resources only focus on the
current state of the entire system. Most often they fail to consider the
system variation and historical behavioral data which causes system
load imbalance. To present a better approach for solving the problem of
VM resource scheduling in a cloud computing environment, we can use
genetic algorithm based VM resource scheduling strategy that focuses
on system load balancing.
• The genetic algorithm approach computes the impact in advance, that
it will have on the system after the new VM resource is deployed in the
system, by utilizing historical data and current state
of the system. It then picks up the solution, which will have the least
effect on the system. By doing this it ensures the better load balancing
and reduces the number of dynamic VM
migrations.
• Individual solutions are selected through a fitness-based process,
where fitter solutions (VM’s schedule likely to give effective
response time) are typically more likely to be selected. The next
step is to generate a second generation population of solutions
from those selected through genetic operators: crossover and
mutation. This generational process is repeated until a
termination condition has been reached i.e. a solution is found
that satisfies minimum response time criteria.
Kernel-based Virtual Machine (KVM)
• Kernel-based Virtual Machine (KVM) is an open source
virtualization technology built into Linux. Specifically, KVM
lets you turn Linux into a hypervisor that allows a host
machine to run multiple, isolated virtual environments called
guests or virtual machines (VMs).
• KVM is production-ready for enterprise workloads with the
features you need to support your physical and virtual
infrastructure, at a lower operating cost. Choosing a
virtualization option based on KVM has many advantages over
other solutions, like VMware vSphere.
• KVM is a type of hypervisor that enables, emulates and provides
for the creation of virtual machines on operating systems.
• These machines are built on top of the Linux kernel, using
operating systems such as Linux, Ubuntu and Fedora. KVM can
be installed on all x86 processors and provide separate
instruction set extensions for Intel and AMD processors.
• KVM supports multiple different guest operating system images
including Linux Kernel, Windows, BSD and Solaris. It also
allocates separate virtualized computing resources for each
virtual machine such as the processor, storage, memory, etc.
KVM has:
• Lower total cost of ownership, freeing up operating budget to explore modern,
innovative technologies.
• No vendor lock-in. Don’t pay for products you aren’t using or restrict your
software choices.
• Cross-platform interoperability: KVM performs on Linux and Windows
platforms so you get more out of your existing infrastructure investments.
• The simplicity of a single virtualization platform to create, start, stop, pause,
migrate, and template hundreds of VMs on hundreds of other hardware or
software.
• Excellent performance: Apps run faster on KVM compared with other
hypervisors.
• The open source advantage: Access the source code and get the flexibility to
integrate with anything.
How does KVM work?
• KVM converts Linux into a type-1 (bare-metal) hypervisor. All
hypervisors need some operating system-level components—
such as a memory manager, process scheduler, input/output
(I/O) stack, device drivers, security manager, a network stack,
and more—to run VMs. KVM has all these components because
it’s part of the Linux kernel.
• Every VM is implemented as a regular Linux process, scheduled
by the standard Linux scheduler, with dedicated virtual
hardware like a network card, graphics adapter, CPU(s),
memory, and disks.
KVM - architecture
KVM Virtualization Architecture
• In KVM there are three kinds of modes Kernel mode, User mode
and Guest mode.
• Again the guest mode has two types guest-user mode and guest-
kernel mode.
• Non I/O tasks are called as guest-user mode while I/O tasks for
data called as guest-kernel mode.
• These requests are handled by Qemu (Quick EMUlator is Open
source software for creating emulation and virtual machine
environment) acting as the emulator in both user mode and
computer emulation.
• QEMU process runs as a userspace process on top of the Linux kernel with
KVM module, and a guest kernel runs on the of emulated hardware in QEMU.
• QEMU can co-work with KVM for hardware based virtualization (Intel VT-x or
AMD AMD-V). Using hardware based virtualization, QEMU does not have to
emulate all CPU instructions, so it is really fast.
• QEMU is a userspace process
• Unprivileged and isolated using SELinux for security
• Each KVM vCPU is a thread
• Host kernel scheduler decides when vCPUs run.
• KVM does not simulate any hardware device. It is used to enable
virtualization capabilities provided by the hardware, such as
Intel VT-x, AMD-V, Arm virtualization extensions. The user-mode
QEMU simulates the mainboard, memory, and I/O devices. The
user-mode QEMU works with the kernel KVM module to
simulate VM hardware. The guest OS runs on the hardware
simulated by the QEMU and KVM.
Quick Emulator (QEMU)
• For virtualization, QEMU is used to emulate devices and certain
privileged instructions and requires either the KQEMU or KVM
kernel modules and the host operating system to provide a
virtual machine environment. It is typically used to run Windows
and DOS applications on x86-based Linux computers.
COMMANDS FOR KVM HYPERVISOR
MANAGEMENT
virsh is a command line interface tool for managing guests and the
hypervisor. The virsh tool is built on the libvirt management API and
operates as an alternative to the xm command and the graphical guest
Manager ( virt-manager ). virsh can be used in read-only mode by
unprivileged users
Help
• virsh help
• virsh help <command>
• virsh help list
Display hypervisor info
• virsh nodeinfo
List all VMs
• virsh list −−all
Start VM
• virsh start <vmname>
• virsh start testvm1
Get VM info
• virsh dominfo <vmname>
• virsh dominfo testvm1
Shutdown VM
• virsh shutdown <vmname|id>
• virsh shutdown testvm1
Power off VM
• virsh destory <vmname>
• virsh destory testvm1
Suspend/pause VM
• virsh suspend <vmname|id>
• virsh suspend testvm1
Resume VM
• virsh resume <vmname|id>
• virsh resume testvm1
Save VM to a file
• virsh save <vmname>
• virsh save testvm1
Restore VM from file
• virsh restore <vmname>
• virsh restore testvm1
Change the maximum memory allocation limit in the guest VM
• virsh setmaxmem <vmname> <newmemsize> −−config
• virsh setmaxmem testvm1 4096M −−config
• virsh setmaxmem testvm1 4G −−config
Change the current memory allocation in the guest VM
• virsh setmem <vmname> <newmemsize> −−config
• virsh setmem testvm1 4096M −−config
• virsh setmem testvm1 4G −−config
Edit the XML configuration for a guest VM
• virsh edit <vmname>
• virsh edit testvm1
Clone a VM
• virt-clone -o <sourcevm> -n <destinationvm> -f
<destination_disk_file>
• virt-clone -o testvm1 -n testvm1-clone -f testvm1-
clone.qcow2