Virtualization and Cloud Computing
Vera Asodi VMware
2010 VMware Inc. All rights reserved
What is Virtualization?
Virtualization is a technology that
allows you to transform hardware into software
Virtualization allows you to run
multiple operating systems simultaneously on a single computer
History
1960s - IBM implemented virtualization as a way to logically partition
mainframe computers into separate virtual machines to enable multitasking.
1960s - MIT Project MAC aimed to design and implement a better
time sharing system.
1990s VMware invented x86 based architecture virtualization.
Virtual Machine
Traditional vs. Virtual Architecture
Traditional Architecture
Virtual Architecture
Benefits of Virtualization
Encapsulation - VMs can be described in a file
Possible to snapshot Easy to move
Enables running multiple operating systems
Consolidation & use of unused computation power Resource management High availability & disaster recovery Create Base Environment
Safe testing of new software
Easy Management
6
Virtual Center
Types of Virtualization
Hosted
Bare Metal
VMM
APP
APP
Host OS
VMM
VMware player Sun VirtualBox VMware workstation QEMU Microsoft virtual PC KVM
8
VMware ESX Microsoft Hyper-V XEN
Types of Virtualization (cont.)
Hosted
Virtualization installs like
application rather than like OS overhead
Bare Metal
Better performance with lower
Can run alongside conventional
applications
Highly efficient direct I/O passthrough architecture for network and disk
Avoid code duplication OS
already has process scheduler, memory management, device support etc.
Complete control over hardware Advanced features like live migration
available
More suitable for personal users
Suitable for production environments
9
Running a VM
The Virtual Machine Monitor (VMM) or Hypervisor is the software layer
that runs the VMs.
There are several ways of doing that.
10
Emulation
Emulation: Do what the CPU does in SW. Example:
addl %ebx, %eax is emulated as: enum {EAX=0, EBX=1, ECX=2, EDX=3, }; unsigned long regs[8]; regs[EAX] += regs[EBX];
Pro: simple
Con: slow Instead of emulation, it would be more efficient to run the VM directly on
the host CPU.
11
The Difficulty of Virtualization
Traditional Architecture
Ring 3 Ring 2 Ring 1 Ring 0 User Apps
Bare Metal Virtualized Architecture
Ring 3 Ring 2 Ring 1 User Apps
Guest OS
OS
Ring 0
VMM
Host Computer System Hardware
Host Computer System Hardware
The problem: the guest OS runs in ring 1, while some privileged instructions need to run in ring 0.
12
Trap and Emulate
Run the VM directly on the host CPU. Trap and emulate sensitive instructions.
Pros: Efficient
Cons: Harder to implement Need hardware support - not all sensitive instructions cause a trap
when executed in a non-privileged mode.
13
Binary Translation
Run the VM directly on the host CPU. The VMM takes a block of binary instructions that are about to be
executed and dynamically translates it into safe instructions.
Translation: Most of the instructions translate identically. Sensitive instructions are translated into safe ones.
Pros: More efficient than emulation No need for hardware support
Cons: Less efficient than trap and emulate Hard to implement
14
Paravirtualization
The OS of the VM is modified so that it calls the hypervisor when it has
to execute sensitive instructions.
Pros: Efficient No need for hardware support Cons: Need a modified version of the guest OS, that is aware to the fact that
it runs on a VM.
15
Running a VM - Summary
Emulation and binary translation: No need for modification of HW or guest OS. Emulation slow, binary translation more efficient.
Trap and emulate: HW modification is required. Improved performance.
Paravirtualization: OS modified and aware. Improved performance. The technologies used in the industry are mainly trap and emulate and
binary translation, or a combination of both.
16
I/O Virtualization
Types of I/O: Block (hard disk) Network User input: keyboard, mouse Sound Video Most performance critical: Block Network
17
NIC Network Interface Card
The NIC is responsible for transmitting and receiving
packets through the network.
The packets that are transmitted and received are
written in the memory.
There are registers to which the driver writes the
instructions to the NIC.
The NIC sends interrupts to the host when it finishes its
task.
18
I/O Virtualization - Emulation
Hypervisor implements a virtual NIC (by the
specification of a real NIC, e.g., Intel, Realtek, Broadcom).
NIC registers are variables.
The hypervisor passes the instructions to the
registers of the physical NIC.
vNICs
Hypervisor
When physical NIC interrupts, hypervisor injects
the interrupt into guest.
pNIC
19
I/O Virtualization Emulation (cont.)
Pros:
Unmodified guest (guest already has drivers for Intel NICs). Slow every access to every NIC register causes a VM exit (trap to
hypervisor). Hypervisor needs to emulate complex hardware.
Cons:
20
I/O Virtualization - Paravirtualization
Add virtual NIC driver into guest (frontend). Implement the virtual NIC in the hypervisor
(backend).
vNICs
Everything works just like in the emulation
case
except protocol between frontend and
backend
pNIC
Hypervisor
21
I/O Virtualization Paravirtualization (cont.)
Paravirtual protocol: Instead of writing to registers, guest calls the hypervisor, passes it start
address and length as arguments Hypervisor knows what it should do
Paravirtual protocol can be high-level, e.g., ring of buffers to transmit (so
NIC doesnt stay idle after one transmission), and independent of particular NIC registers
Pro: fast no need to emulate physical device
Con: requires guest driver
22
I/O Virtualization Direct Access
Pull NIC out of the host, and plug it into the
guest.
Guest is allowed to access NIC registers
directly, no hypervisor intervention.
vNICs
Host cannot access NIC anymore. Pros:
As fast as possible
Need NIC per guest (plus one for host). Cannot encapsulate guest packets, monitor or
modify them at the hypervisor level.
Hypervisor
pNICs
Cons:
23
I/O Virtualization SR-IOV
Single Root I/O Virtualization Contains a physical function controlled by the
host, used to create multiple virtual functions.
vNICs
Each virtual function is assigned to a guest (like
in direct assignment). Hypervisor
Each guest thinks it has full control of the NIC,
accesses registers directly (like in direct access).
The NIC does multiplexing/demultiplexing of
traffic.
pNIC
24
I/O Virtualization SR-IOV (cont.)
Pros: As fast as possible Need only one NIC (as opposed to direct assignment)
Cons: Few hypervisors fully support it Expensive Requires new hardware Cannot encapsulate guest packets, monitor or modify them at the
hypervisor level.
25
Live Migration
1 1
POWER SUPPLY
2
OVER TEMP INTER LOCK
2
POWER SUPPLY
5
PLAYER
HP ProLiant DL380G6
1 1
POWER SUPPLY
2
OVER TEMP INTER LOCK
2
POWER SUPPLY
5
PLAYER
HP ProLiant DL380G6
POWER CAP
1A 3G 5E 7C 9i
DIMMS 9i 7C 5E 3G 1A
POWER CAP
1A 3G 5E 7C 9i
DIMMS 9i 7C 5E 3G 1A
2
2D 4B 6H 8F 8F 6H 4B 2D
6
2D 4B 6H 8F 8F 6H 4B 2D
2
1
PROC
ONLINE SPARE MIRROR
1
PROC
ONLINE SPARE MIRROR
2
PROC
2
PROC
FANS
FANS
26
Global Performance Optimization
1 1
POWER SUPPLY
2
OVER TEMP INTER LOCK
2
POWER SUPPLY
5
PLAYER
HP ProLiant DL380G6
1
POWER SUPPLY
1 2
POWER SUPPLY
2
OVER TEMP INTER LOCK
5
PLAYER
HP ProLiant DL380G6
POWER CAP
1A 3G 5E 7C 9i
DIMMS 9i 7C 5E 3G 1A
POWER CAP
1A 3G 5E 7C 9i
DIMMS 9i 7C 5E 3G 1A
2
2D 4B 6H 8F 8F 6H 4B 2D
6
2D 4B 6H 8F 8F 6H 4B 2D
ONLINE SPARE MIRROR
2
1
PROC
1
PROC
ONLINE SPARE MIRROR
2
PROC
2
PROC
FANS
FANS
Imbalanced Balanced Giant Computer
Heavy Load
1 1
POWER SUPPLY
2
OVER TEMP INTER LOCK
2
POWER SUPPLY
5
PLAYER
HP ProLiant DL380G6
1 1
POWER SUPPLY
2
OVER TEMP INTER LOCK
2
POWER SUPPLY
5
PLAYER
HP ProLiant DL380G6
POWER CAP
1A 3G 5E 7C 9i
DIMMS 9i 7C 5E 3G 1A
POWER CAP
1A 3G 5E 7C 9i
DIMMS 9i 7C 5E 3G 1A
2 2 6
2D 4B 6H 8F 8F 6H 4B 2D
1
2D 4B 6H 8F 8F 6H 4B 2D
ONLINE SPARE MIRROR
2
PROC
1
PROC
ONLINE SPARE MIRROR
2
PROC
PROC
FANS
1 6
FANS
Lighter Load
27
Global Power Optimization
20% Average Power Savings
11 11 22 22
OVER OVER TEMP TEMP INTER INTER LOCK LOCK
11
55
PLAYER PLAYER
HP HP ProLiant ProLiant DL380G6 DL380G6
1 1
POWER SUPPLY
2
OVER TEMP INTER LOCK
2
POWER SUPPLY
5
PLAYER
HP ProLiant DL380G6
POWER POWER POWER POWER SUPPLY SUPPLY SUPPLY SUPPLY POWER CAP POWER CAP
DIMMS DIMMS 1A 3G 5E 7C 9i9i 9i9i 7C 5E 3G 1A 1A 3G 5E 7C 7C 5E 3G 1A
POWER CAP
1A 3G 5E 7C 9i
DIMMS 9i 7C 5E 3G 1A
22
2D 4B 6H 8F 2D 4B 6H 8F 8F 6H 4B 2D 8F 6H 4B 2D
66
2D 4B 6H 8F 8F 6H 4B 2D
2
1
PROC
ONLINE SPARE MIRROR
11
PROC PROC
ONLINE ONLINE SPARE SPARE MIRROR MIRROR
22
PROC PROC
2
PROC
FANS FANS
11
22
33
44
55
66
33
77
FANS
44
88
1 1
POWER SUPPLY
2
OVER TEMP INTER LOCK
2
POWER SUPPLY
5
PLAYER
HP ProLiant DL380G6
POWER CAP
PWR
APPs
1 1
POWER SUPPLY
2
OVER TEMP INTER LOCK
2
POWER SUPPLY
5
PLAYER
HP ProLiant DL380G6
1A 3G 5E 7C 9i
DIMMS 9i 7C 5E 3G 1A
POWER CAP
1A 3G 5E 7C 9i
DIMMS 9i 7C 5E 3G 1A
2
2D 4B 6H 8F 8F 6H 4B 2D
6
2D 4B 6H 8F 8F 6H 4B 2D
2
1
PROC
ONLINE SPARE MIRROR
1
PROC
ONLINE SPARE MIRROR
2
PROC
2
PROC
FANS
FANS
28
Live Migration
1 1
POWER SUPPLY
2
OVER TEMP INTER LOCK
2
POWER SUPPLY
5
PLAYER
HP ProLiant DL380G6
1 1
POWER SUPPLY
2
OVER TEMP INTER LOCK
2
POWER SUPPLY
5
PLAYER
HP ProLiant DL380G6
POWER CAP
1A 3G 5E 7C 9i
DIMMS 9i 7C 5E 3G 1A
POWER CAP
1A 3G 5E 7C 9i
DIMMS 9i 7C 5E 3G 1A
2
2D 4B 6H 8F 8F 6H 4B 2D
6
2D 4B 6H 8F 8F 6H 4B 2D
2
1
PROC
ONLINE SPARE MIRROR
1
PROC
ONLINE SPARE MIRROR
2
PROC
2
PROC
FANS
FANS
State
Continue until n is small enough 2 (depends on the desired downtime)
29
HW/SW Separation
30
Cloud Computing
31
Cloud Computing
Abstract the technology infrastructure The user doesnt have to know
There is a compute power out there available for use
Flexible * Dynamic * On Demand * Efficient
32
Principles of Cloud Computing
Internal Cloud
The user should focus on the Application All the rest is taken care of by the Cloud Provider
33
Types of Clouds
SaaS Software as a Service IaaS Infrastructure as a Service PaaS Platform as a Service
34
SaaS
Software as a Service Examples: Gmail, Salesforce.com
The cloud provider provides a SW that is available for use over the
internet.
The user only pays for usage rather than buy the SW.
The user does not have to worry about installation, upgrades, and the
infrastructure needed for the SW.
35
IaaS
Infrastructure as a Service Example: Amazon EC2
The cloud provider provides the user a computer with CPU, memory,
storage, network, etc. that is available for use through the internet.
The user pays for the CPU cycles and network usage.
The user does not have to buy the HW and provide the space, electricity
maintenance, etc.
Very suitable for startups.
36
PaaS
Platform as a Service Example: Googles App Engine
The cloud provider provides not only the
infrastructure but also the application stack (e.g. JVM, web server, development and testing tools).
The user needs only to add the code.
37
Benefits of Cloud Computing
Tap into external computing power quickly, as needed Accessible using standard internet protocols
Consumption based pricing - reduced costs
Lower maintenance costs High availability Scalability Improved economics due to shared
infrastructure
Eco-friendly
38
39