Nothing Special   »   [go: up one dir, main page]

VDC - Compute - Tagged

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

ECCE 448-CLOUD INFRASTRUCTURE AND SERVICES

VIRTUAL DATA CENTER -


COMPUTE
Dr. Khaled Salah

(Slides based on EMC2 and my own)

Copyright © 2011 EMC Corporation. All Rights Reserved. 1


Virtualized Data Center
Transforming a Classic Data Center Virtualized Data Center (VDC)
(CDC) into a Virtualized Data Center
(VDC) requires virtualizing the core
elements of the data center. Virtualize Network

Virtualize Storage

Virtualize Compute

Classic Data Center (CDC)

Using a phased approach to a


virtualized infrastructure enables
smoother transition to virtualize core
elements.

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

It is a technique of masking or abstracting the physical compute


hardware and enabling multiple operating systems (OSs) to run
concurrently on a single or clustered physical machine(s).

• Enables creation of multiple virtual


machines (VMs), each running an OS
and application
 VM is a logical entity that looks and
behaves like physical machine
• Virtualization layer resides between Virtualization Layer
hardware and VMs x86 Architecture
 Also known as hypervisor
• VMs are provided with standardized
hardware resources CPU NIC Card Memory Hard Disk

Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 4
Jargon

• The terms physical machine, host machine, compute, and server


are used interchangeably.

• The terms virtual machine, guest machine, virtual compute, and


virtual server are also used interchangeably .

Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 5
Need for Compute Virtualization

Hypervisor
x86 Architecture
x86 Architecture

CPU NIC Card Memory Hard Disk


CPU NIC Card Memory Hard Disk

Before Virtualization After Virtualization


• Runs single operating system (OS) per • Runs multiple operating systems (OSs)
machine at a time per machine concurrently
• Couples s/w, OS, and h/w tightly • Makes OS and applications h/w
• May create conflicts when multiple independent
applications run on the same machine • Isolates VM from each other, hence no
• Underutilizes resources conflict
• Is inflexible and expensive • Improves resource utilization
• Offers flexible infrastructure at low cost

Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 6
Hypervisor
Hypervisor

It is a software that allows multiple operating systems (OSs) to run


concurrently on a physical machine and to interact directly with the
physical hardware.

• Has two components


 Kernel
 Virtual Machine Monitor
(VMM)
VMM VMM VMM

Hypervisor (Kernel and VMM)


x86 Architecture

CPU NIC Card Memory Hard Disk

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

x86 Architecture Host Operating System


x86 Architecture

CPU NIC Card Memory Hard Disk


CPU NIC Card Memory Hard Disk

Type 1: Bare-Metal Hypervisor Type 2: Hosted Hypervisor

Type 1: Bare-Metal Hypervisor Type 2: Hosted Hypervisor


• It acts as an operating system (OS) • It installs and runs as an application
• It installs and runs on x86 bare- • It relies on operating system (OS)
metal hardware running on physical machine for
• It is more efficient than a hosted HV device support and physical
resource management

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)

• Virtual Machine Monitor (VMM) runs in the


privileged Ring 0
• VMM decouples guest operating system (OS)
from the underlying physical hardware
• Each VM is assigned a VMM
 Provides virtual components to each VM
 Performs Emulation using Hooks or Binary
Translation (BT) of non-virtualizable OS
instructions
 Binary Translation provides ‘Full Virtualization’
because the hypervisor completely decouples
the guest operating system from the underlying
hardware.
 Guest OS requires no modifications
 Guest OS is not aware of being virtualized

Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 14
Full Virtualization (1/2)

• Nonvirtualized instructions include


sensitive/critical kernel operations such as
CPU ops, memory management, interrupt
handling and time keeping.
• For example, if the guest OS wants to
modify/read the CPUs Processor Status Word
containing important flags/control bitfields,
the BT program would scan the guest binary
for such instructions and replace them with
either a call to hypervisor or some opcode(s)
to trap into VMM address space.

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

 Virtual machine (VM) is a discrete x86 Architecture

set of files such as configuration


file, virtual disk files, virtual BIOS
file, VM swap file, and log file CPU NIC Card Memory Hard Disk

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

• Stores the contents of the VM’s disk drive


Virtual Disk
• Appears like a physical disk drive to VM
File
• VM can have multiple disk drives

• Keeps a log of VM activity


Log File
• Is useful for troubleshooting

• Stores the configuration information chosen during VM


creation
Virtual • Includes information such as virtual machine name, guest OS,
Configuration virtual disk parameters, number of CPUs and memory sizes,
File number of adaptors and associated MAC addresses, the
networks to which the network adapters connect, SCSI
controller type, and the disk type.

Copyright © 2011 EMC Corporation. All Rights Reserved. Virtualized Data Center – Compute 22
Virtual Machine Hardware

Parallel Serial/Com USB controller


port ports and USB devices

IDE controllers Floppy controller


and floppy drives

Graphic card Virtual Machine Mouse

RAM Keyboard

VM chipset with one Network adapters


or more CPUs SCSI controllers (NIC and HBA)

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

Threa Threa Threa Threa Threa Threa Threa Threa


Thread d d d d d d d d

Core

Socket

Single – core Dual – core Quad – core


Dual – socket system Single – socket system Single – socket system

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

• Hypervisor running on a hyper- LCP LCP

threading-enabled CPU provides U U

improved performance and Thread 1 and 2 Dual – core Thread 1 and 2


Single – socket system
utilization with hyperthreading

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

Hyperthreaded dual – core


Single – socket system

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

No memory shortage, balloon remains


uninflated

Virtual Machine (VM)


1. Memory shortage, balloon inflates
2. Driver demands memory from guest
operating system (OS)
3. Guest OS forces page out
4. Hypervisor reclaims memory

Virtual Machine (VM)

1. Memory shortage resolved,


deflates balloon
2. Driver relinquishes memory
3. Guest OS can use pages
4. Hypervisor grants memory
Virtual Machine (VM)

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

You might also like