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
2
History
 1960’s - IBM implemented virtualization as a way to logically partition
mainframe computers into separate virtual machines to enable
multitasking.
 1960’s - MIT – Project ‘MAC’ – aimed to design and implement a better
time sharing system.
 1990’s – VMware invented x86 based architecture virtualization.
3
Virtual Machine
4
Traditional vs. Virtual Architecture
Traditional Architecture
5
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
7
Types of Virtualization
Hosted
VMM
APP
Bare Metal
APP
Host OS
 VMware player
 Sun VirtualBox
 VMware workstation  QEMU
 Microsoft virtual PC  KVM
8
VMM
 VMware ESX
 Microsoft Hyper-V
 XEN
Types of Virtualization (cont.)
Hosted
 Virtualization installs like
application rather than like OS
 Can run alongside conventional
applications
 Avoid code duplication – OS
already has process scheduler,
memory management, device
support etc.
 More suitable for personal users
Bare Metal
 Better performance with lower
overhead
 Highly efficient direct I/O passthrough architecture for network and
disk
 Complete control over hardware
 Advanced features like live migration
available
 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
User Apps
Bare Metal Virtualized Architecture
Ring 3
User Apps
Ring 2
Ring 2
Ring 1
Ring 1
Guest OS
Ring 0
VMM
Ring 0
OS
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.
vNICs
 The hypervisor passes the instructions to the
registers of the physical NIC.
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…).
 Cons:
• Slow – every access to every NIC register causes a VM exit (trap to
hypervisor).
• Hypervisor needs to emulate complex hardware.
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…
Hypervisor
 …except – protocol between frontend and
backend
pNIC
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 doesn’t 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.
Hypervisor
 Pros:
• As fast as possible
 Cons:
• Need NIC per guest (plus one for host).
• Cannot encapsulate guest packets, monitor or
modify them at the hypervisor level.
23
pNICs
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.
24
pNIC
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
2
POWER
SUPPLY
POWER
SUPPLY
POWER CAP
26
3
5
6
3
7
4
8
1
1
2
POWER
SUPPLY
POWER
SUPPLY
POWER CAP
4
5
3
5
2
6
3
7
4
8
PLAYER
2
PROC
MIRROR
2
1
INTER
LOCK
8F 6H 4B 2D
ONLINE
SPARE
1
FANS
1
HP
ProLiant
DL380G6
2
DIMMS
9i 7C 5E 3G 1A
2D 4B 6H 8F
PROC
6
OVER
TEMP
1A 3G 5E 7C 9i
2
PROC
MIRROR
2
2
PLAYER
8F 6H 4B 2D
ONLINE
SPARE
1
1
1
INTER
LOCK
DIMMS
9i 7C 5E 3G 1A
2D 4B 6H 8F
PROC
HP
ProLiant
DL380G6
2
OVER
TEMP
1A 3G 5E 7C 9i
FANS
4
5
6
Global Performance Optimization
1
1
2
POWER
SUPPLY
POWER
SUPPLY
POWER CAP
5
6
3
7
1
1
2
POWER
SUPPLY
POWER
SUPPLY
3
4
5
4
5
2
6
3
7
4
8
2
PROC
MIRROR
2
1
PLAYER
8F 6H 4B 2D
ONLINE
SPARE
1
FANS
1
HP
ProLiant
DL380G6
2
OVER
TEMP
DIMMS
9i 7C 5E 3G 1A
2D 4B 6H 8F
PROC
6
INTER
LOCK
POWER CAP
1A 3G 5E 7C 9i
2
PROC
MIRROR
2
2
PLAYER
8F 6H 4B 2D
ONLINE
SPARE
1
1
1
INTER
LOCK
DIMMS
9i 7C 5E 3G 1A
2D 4B 6H 8F
PROC
HP
ProLiant
DL380G6
2
OVER
TEMP
1A 3G 5E 7C 9i
FANS
3
4
5
6
8
Imbalanced
Balanced
Giant Computer
Heavy Load
1
1
2
POWER
SUPPLY
POWER
SUPPLY
POWER CAP
1
1
HP
ProLiant
DL380G6
2
OVER
TEMP
5
DIMMS
9i 7C 5E 3G 1A
2D 4B 6H 8F
8F 6H 4B 2D
2
1
2
POWER
SUPPLY
POWER
SUPPLY
POWER CAP
PLAYER
INTER
LOCK
1A 3G 5E 7C 9i
6
PROC
1
PROC
MIRROR
27
2
3
4
5
1
6
3
7
4
8
Lighter Load
3
5
2
6
3
7
4
8
PLAYER
2
PROC
MIRROR
2
1
INTER
LOCK
8F 6H 4B 2D
ONLINE
SPARE
FANS
FANS
HP
ProLiant
DL380G6
2
DIMMS
9i 7C 5E 3G 1A
2D 4B 6H 8F
1
2
OVER
TEMP
1A 3G 5E 7C 9i
PROC
ONLINE
SPARE
1
4
5
6
Global Power Optimization
20% Average
Power Savings
11
11
HP
HP
ProLiant
ProLiant
DL380G6
DL380G6
22
OVER
OVER
TEMP
TEMP
22
POWER
POWER POWER
POWER
SUPPLY
SUPPLY SUPPLY
SUPPLY
11
55
22
66
33
77
44
88
1
PLAYER
PLAYER
INTER
INTER
LOCK
LOCK
POWER
POWER
CAP
CAP
2D
2D4B4B6H
6H8F8F
11
PROC
PROC
11
8F8F6H
6H4B4B2D
2D
ONLINE
ONLINE
SPARE
SPARE
1
1
2
POWER
SUPPLY
POWER
SUPPLY
POWER CAP
33
28
3
1
5
2
6
3
7
HP
ProLiant
DL380G6
4
8
PWR
APPs
2
5
1
1
2
POWER
SUPPLY
POWER
SUPPLY
6
8
5
2
6
3
7
HP
ProLiant
DL380G6
4
8
PLAYER
2
PROC
MIRROR
3
1
INTER
LOCK
8F 6H 4B 2D
ONLINE
SPARE
2
4
2
OVER
TEMP
DIMMS
9i 7C 5E 3G 1A
2D 4B 6H 8F
1
7
PLAYER
5
FANS
1
6
3
PROC
4
POWER CAP
PROC
6
5
2
2
3
1A 3G 5E 7C 9i
2
4
1
INTER
LOCK
8F 6H 4B 2D
MIRROR
FANS
1
HP
ProLiant
DL380G6
2
OVER
TEMP
DIMMS
9i 7C 5E 3G 1A
ONLINE
SPARE
1
PROC
MIRROR
2
2
POWER
SUPPLY
2D 4B 6H 8F
PROC
66
PLAYER
8F 6H 4B 2D
ONLINE
SPARE
1
FANS
1
55
INTER
LOCK
DIMMS
9i 7C 5E 3G 1A
2D 4B 6H 8F
PROC
44
2
OVER
TEMP
1A 3G 5E 7C 9i
1
1A 3G 5E 7C 9i
22
PROC
PROC
MIRROR
MIRROR
22
POWER
SUPPLY
POWER CAP
DIMMS
DIMMS
1A1A3G
3G5E5E7C
7C 9i9i 9i9i 7C
7C5E5E3G
3G1A1A
FANS
FANS
4
5
6
Live Migration
1
1
2
POWER
SUPPLY
POWER
SUPPLY
POWER CAP
3
5
6
3
7
4
8
4
5
2
POWER
SUPPLY
1
Continue until n
is small enough 2
(depends on the
desired downtime)
n
3
5
2
6
3
7
4
8
PLAYER
2
PROC
MIRROR
2
1
INTER
LOCK
8F 6H 4B 2D
ONLINE
SPARE
1
FANS
1
HP
ProLiant
DL380G6
2
OVER
TEMP
DIMMS
9i 7C 5E 3G 1A
2D 4B 6H 8F
PROC
6
State
29
1
1
POWER
SUPPLY
POWER CAP
1A 3G 5E 7C 9i
2
PROC
MIRROR
2
2
PLAYER
8F 6H 4B 2D
ONLINE
SPARE
1
1
1
INTER
LOCK
DIMMS
9i 7C 5E 3G 1A
2D 4B 6H 8F
PROC
HP
ProLiant
DL380G6
2
OVER
TEMP
1A 3G 5E 7C 9i
FANS
4
5
6
HW/SW Separation
30
Cloud Computing
31
Cloud Computing
 Abstract the technology infrastructure
 The user doesn’t 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: Google’s 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