VDC - Compute - Tagged
VDC - Compute - Tagged
VDC - Compute - Tagged
Virtualize Storage
Virtualize Compute
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 2
Compute Virtualization Overview
Topics covered in this lesson:
• Drivers for compute virtualization
• Types of hypervisor
• Benefits of compute virtualization
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 3
Compute Virtualization
Compute Virtualization
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 4
Jargon
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 5
Need for Compute Virtualization
Hypervisor
x86 Architecture
x86 Architecture
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 6
Hypervisor
Hypervisor
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 7
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 8
Types of Hypervisor
APP
Hypervisor
Hypervisor
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 9
Popular Hypervisors
• Bare-metal Hypervisor
VMware ESX and ESXi, aka vSphere
Citrix XenServer
Oracle VM
• Hosted Hypervisor
VMware workstation/fusion/player
VMware Server
MS Virtual PC
Oracle VM VirtualBox
Parallels/Mac Hypervisor
• Both Types
KVM
MS Hyper-V
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 10
Benefits of Compute Virtualization
• Server Consolidation
running multiple virtual machines on a physical server
• Isolation
While VMs can share the physical resources of a PM, they remain
completely isolated from each other as if they were separate PMs.
If a VM crashes, the other VMs remain unaffected.
• Encapsulation, Portability, and HW Independence
A VM is a package with App, OS, and HW resources
A VM is configured with virtual components that are completely
independent of the underlying physical hardware
VM can be moved and copied from one location to another just like a file
• Reduced cost
Space (leased or owned) for physical machines, power and cooling,
Hardware, and maintenance
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 11
Compute Virtualization Techniques
Topics covered in this lesson:
• Requirements of x86 hardware virtualization
• Compute virtualization techniques
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 12
Requirements: x86 Hardware Virtualization
• An operating system (OS) is designed to run on a
bare-metal hardware and to fully own the
hardware
Ring 3 User Apps
x86 architecture offer four levels of privilege
Ring 0, 1, 2, and 3 Ring 2
User apps run in Ring 3
Ring 1
OS run in Ring 0 (most privileged)
Ring 0 OS
• Challenges of virtualizing x86 hardware
Requires placing the virtualization layer below the OS layer
X86 Hardware
Is difficult to capture and translate privileged OS instructions
at runtime
• Techniques to virtualize compute
Full, Para, and hardware assisted virtualization
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 13
Full Virtualization (1/2)
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 14
Full Virtualization (1/2)
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 15
Paravirtualization
• Para means “alongside”
• refers to communication between the guest OS
and the hypervisor to improve performance!
• Guest operating system (OS) knows that it is
virtualized
• Guest OS runs in Ring 0
• Modified guest OS kernel is used, such as Linux
and OpenBSD
The source code of the guest OS is
modified. All system HW resource access
related code is modified with Hypervisor
APIs.
• Unmodified guest OS is not supported,
Compatibility and portability are poor
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 16
Hardware Assisted Virtualization
• Enabled by AMD-V and Intel VT
technologies in the x86 architecture
• Achieved by using hypervisor-aware
CPU
privileged instructions (fullV) or
Hypercalls (paraV) will automatically
trap to the hypervisor, removing the
need for either binary translation or
paravirtualization.
The guest VMM state is stored in Virtual
Machine Control Structures (VT-x) or
Virtual Machine Control Blocks (AMD-V)
Reduces virtualization overhead caused
due to full and paravirtualization
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 17
Xen Hypervisor
• Xen is a bare-metal HV, that employees
paravirtualization.
• The Xen Virtual Machine Monitor handles
all hardware access, using the hypervisor to
pass requests to the host (Dom 0).
• The hypervisor uses back-end drivers to
allocate resources to Dom U virtual
machines.
• In the world of Xen, the host system with
the hypervisor is referred to as Dom 0 (or
Domain 0), and a guest system is known as
Dom U (Domain U)
• Dom 0 also provides console management
to Xen VMM
• Any user with full access to Dom 0 also has
complete control over every active Dom U.
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 18
Oracle VM Server – based on Xen Technology
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 19
Virtual Machine
Topics covered in this lesson:
• Virtual machine (VM) files
• File systems that manage Virtual machine files
• Virtual machine hardware
• Virtual machine console
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 20
Virtual Machine
• From a user’s perspective, a
logical compute system
Runs an operating system (OS) and
application like a physical machine
Contains virtual components such
as CPU, RAM, disk, and NIC
• From a hypervisor’s perspective Hypervisor
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 21
Virtual Machine Files
File name Description
Virtual BIOS • Stores the state of the virtual machine’s (VM’s) BIOS
File
Virtual Swap • Is a VM’s paging file which backs up the VM RAM contents
File • The file exists only when VM is running
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 22
Virtual Machine Hardware
RAM Keyboard
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 23
VM Hardware Components
Virtual Hardware Description
• Virtual machine (VM) can be configured with one or
vCPU more virtual CPUs
• Number of CPUs allocated to a VM can be changed
• Amount of memory presented to the guest operating
vRAM system (OS)
• Memory size can be changed based on requirement
• Stores VM's OS and application data
Virtual Disk
• A VM should have at least one virtual disk
• Enables a VM to connect to other physical and virtual
vNIC
machines
Virtual DVD/CD-ROM • It maps a VM’s DVD/CD-ROM drive to either a physical
Drive drive or an .iso file
• It maps a VM’s floppy drive to either a physical drive or
Virtual Floppy Drive
an .flp file
Virtual SCSI Controller • VM uses virtual SCSI controller to access virtual disk
• Maps VM’s USB controller to the physical USB
Virtual USB Controller
controller
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 24
Virtual Machine Console
• Provides mouse, keyboard, and screen functionality
• To install an operating system (OS), a virtual machine console is
used.
• Allows access to BIOS of the VM
• It offers the ability to power the virtual machine on/off and to
reset it.
• Typically used for virtual hardware configuration and
troubleshooting issues
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 25
Copyright © 2011 EMC Corporation. All Rights Reserved. Business Continuity in VDC 26
Resource Management
Topics covered in this lesson:
• CPU and memory resource optimization techniques
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 27
Optimizing CPU Resources
• Modern CPUs are equipped with multiple cores and hyper-
threading
Multi-core processors have multiple processing units (cores) in a
single CPU
Hyper-threading makes a physical CPU appear as two or more
logical CPUs
• Allocating a CPU resource efficiently and fairly is critical
• Hypervisor schedules virtual CPUs on the physical CPUs
• Hypervisors support multi-core, hyper-threading, and CPU load-
balancing features to optimize CPU resources
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 28
Multi-core Processors (1/2)
VM with VM with VM with
one CPU two CPUs four CPUs
Virtual CPU
Virtual
Physical
Core
Socket
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 29
Multi-core Processors (1/2)
• Multi-core CPUs provide many advantages to a hypervisor that performs
multitasking of virtual machines.
• A dual-core CPU, for example, can provide almost double the performance of
a single-core CPU by allowing two virtual CPUs to execute at the same time.
• Intel and AMD have developed CPUs that combine two or more cores into a
single integrated circuit, called a socket.
• A hypervisor running on a physical machine can have single access to core,
dual core, or quad core CPUs.
• Virtual machines can be configured with one or more virtual CPUs.
When a virtual machine is scheduled, its virtual CPUs are scheduled to run on a
physical CPU by the hypervisor.
To maximize the overall utilization and performance, a hypervisor scheduler
optimizes the placement of virtual CPUs onto different sockets/processors.
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 30
Hyper-threading
VM with VM with VM with
• Makes a physical CPU appear as one CPU two CPUs one CPU
two Logical CPUs (LCPUs)
Enables operating system (OS) to
schedule two or more threads
simultaneously
• Two LCPUs share the same
physical resources
While the current thread is stalled,
CPU can execute another thread
Due to cache miss or data
LCP LCP
dependency U U
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 31
HT Technology – how it works?
• HT technology allows each microprocessor core to execute two software threads
at the same time.
• Hyper-threading exposes multiple logical cores for a single physical CPU core. In
simple terms, hyper-threading makes context-switching more efficient for each
CPU core.
• How?
Adding the second set of a few internal core components, such as interrupt controller,
general, control and special registers. The second set of registers allows the CPU to
keep the thread state of both cores, and effortlessly switch between them by
switching the register set.
Modifying other core units to auto-switch between two threads. Some internal units
automatically switch from one thread to another, and back, while others switch to
another thread only when the current thread is stalled, i.e. is waiting for data.
• HT technology results in better utilization of core resources and improved
performance.
Although sharing of some resources, like level 1 cache, may lower process
performance under certain conditions.
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 32
HT Technology – how it works?
• If the number of threads is
higher than the number of
cores, Hyper-threading is
enabled.
• To date, all consumer-oriented
CPUs with Hyper-threading
have 2 threads per core, so if
HT is enabled, the number of
threads will be 2x the number
of cores.
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 33
CPU Load Balancing (1/2)
VM with VM with VM with
one CPU one CPU one CPU
LCP LCP
U U
LCP LCP
U U
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 34
CPU Load Balancing (2/2)
• When a hypervisor is running on multi-processor and hyper-
threading-enabled compute systems, balancing the load across
CPUs is critical to the performance.
• In this environment, load balancing is achieved by migrating a
thread from one logical CPU (over utilized) to another (under
utilized) to keep the load balanced.
• The hypervisor intelligently manages the CPU load by spreading
it smoothly across the CPU cores in the compute system.
At regular intervals, the hypervisor looks to migrate the CPU of a
virtual machine (virtual CPU) from one logical CPU to another to
keep the load balanced.
If the CPU has no work assigned, it is put into a halted state.
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 35
Copyright © 2011 EMC Corporation. All Rights Reserved. Business Continuity in VDC 36
Virtual Machine Affinity
• VM to CPU affinity
All threads of the same VM run on a specific CPU (possibly a CPU with
multi-core)
• VM to VM affinity:
Selected group of VMs are affinitized to same hypervisor
To improve performance, if VMs are communicating with each other
heavily
For licensing reasons
Anti-affinity ensures that selected VMs are not together on a
hypervisor
for availability, green computing, or load balancing
Anti-affinity allows VM to migrate on different hypervisors in a cluster
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 37
Optimizing Memory Resource
• Hypervisor manages a machine’s physical memory
Part of this memory is used by the hypervisor
Rest is available for virtual machines (VMs)
• How many VMs can run if each VM requires 2GB with only 4GB
on hosted PM?
• VMs can be configured with more memory than physically
available, called ‘memory overcommitment’
Memory optimization is done to allow overcommitment
allows the hypervisor to use memory reclamation techniques to take the
inactive or unused memory away from the idle VMs and give it to other
active VMs
• Memory management techniques are: (1) Transparent page sharing,
(2) memory ballooning, and (3) memory swapping
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 38
Transparent Page Sharing
• Hypervisor detects identical memory pages of virtual machines (VMs) and maps them
to same physical page
Read-only when shared
• For writes, hypervisor treats the shared pages as copy-on-write
• Attempts to write on shared page
Generates minor page fault
Creates private copy after write and remaps the memory
In this way, VMs can safely modify the shared pages without disrupting other VMs sharing
that memory.
VM0 Memory VM1 Memory VM2 Memory
Private copy
Physical Memory
Memory Page
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 39
Memory Ballooning
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 40
Memory Swapping
• Each powered-on virtual machine (VM) needs its own swap file
Created when the VM is powered-on
Deleted when the VM is powered-off
• Hypervisor swaps out the VM’s memory content if memory is
scarce
• The hypervisor copies the VM physical page contents to their
corresponding swap files before assigning the pages to the
virtual machines that need memory.
• Swapping is the last option because it causes severely negative
performance impact
Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 41