590 likes | 900 Views
Virtualizing the Data Center with Xen. Steve Hand University of Cambridge and XenSource. What is Xen Anyway?. Open source hypervisor run multiple OSes on one machine dynamic sizing of virtual machine much improved manageability Pioneered paravirtualization
E N D
Virtualizing the Data Center with Xen Steve Hand University of Cambridgeand XenSource
What is Xen Anyway? • Open source hypervisor • run multiple OSes on one machine • dynamic sizing of virtual machine • much improved manageability • Pioneered paravirtualization • modify OS kernel to run on Xen • (applications mods not required) • extremely low overhead (~1%) • Massive development effort • first (open source) release 2003. • today have hundreds of talented community developers
Problem: Success of Scale-out • “OS+app per server” provisioning leads to server sprawl • Server utilization rates <10% • Expensive to maintain, house, power, and cool • Slow to provision, inflexible to change or scale • Poor resilience to failures
Solution: Virtualize With Xen • Consolidation: fewer servers slashes CapEx and OpEx • “Instant on” provisioning: any app on any server, any time • Higher utilization: make the most of existing investments • Robustness to failures and “auto-restart” of VMs on failure
Further Virtualization Benefits • Separating the OS from the hardware • Users no longer forced to upgrade OS to run on latest hardware • Device support is part of the platform • Write one device driver rather than N • Better for system reliability/availability • Faster to get new hardware deployed • Enables “Virtual Appliances” • Applications encapsulated with their OS • Easy configuration and management
Virtualization Possibilities • Value-added functionality from outside OS: • Fire-walling / network IDS / “inverse firewall” • VPN tunnelling; LAN authentication • Virus, mal-ware and exploit scanning • OS patch-level status monitoring • Performance monitoring and instrumentation • Storage backup and snapshots • Local disk as just a cache for network storage • Carry your world on a USB stick • Multi-level secure systems
This talk • Introduction • Xen 3 • para-virtualization, I/O architecture • hardware virtualization (today + tomorrow) • XenEnterprise: overview and performance • Case Study: Live Migration • Outlook
Xen 3.0 (5th Dec 2005) • Secure isolation between VMs • Resource control and QoS • x86 32/PAE36/64 plus HVM; IA64, Power • PV guest kernel needs to be ported • User-level apps and libraries run unmodified • Execution performance close to native • Broad (linux) hardware support • Live Relocation of VMs between Xen nodes • Latest stable release is 3.1 (May 2007)
Xen 3.x Architecture VM3 VM0 VM1 VM2 Device Manager & Control s/w Unmodified User Software Unmodified User Software Unmodified User Software GuestOS (XenLinux) GuestOS (XenLinux) GuestOS (XenLinux) Unmodified GuestOS (WinXP)) AGP ACPI PCI Back-End SMP Native Device Drivers Front-End Device Drivers Front-End Device Drivers Front-End Device Drivers HVM x86_32 x86_64 IA64 Virtual CPU Virtual MMU Control IF Safe HW IF Event Channel Xen Virtual Machine Monitor Hardware (SMP, MMU, physical memory, Ethernet, SCSI/IDE)
Para-Virtualization in Xen • Xen extensions to x86 arch • Like x86, but Xen invoked for privileged ops • Avoids binary rewriting • Minimize number of privilege transitions into Xen • Modifications relatively simple and self-contained • Modify kernel to understand virtualised env. • Wall-clock time vs. virtual processor time • Desire both types of alarm timer • Expose real resource availability • Enables OS to optimise its own behaviour
Para-Virtualizing the MMU • Guest OSes allocate and manage own PTs • Hypercall to change PT base • Xen must validate PT updates before use • Allows incremental updates, avoids revalidation • Validation rules applied to each PTE: • 1. Guest may only map pages it owns* • 2. Pagetable pages may only be mapped RO • Xen traps PTE updates and emulates, or ‘unhooks’ PTE page for bulk updates
SMP Guest Kernels • Xen 3.x supports multiple VCPUs • Virtual IPI’s sent via Xen event channels • Currently up to 32 VCPUs supported • Simple hotplug/unplug of VCPUs • From within VM or via control tools • Optimize one active VCPU case by binary patching spinlocks • NB: Many applications exhibit poor SMP scalability – often better off running multiple instances each in their own OS
Performance: SPECJBB Average 0.75% overhead 3 GHz Xeon 1GB memory / guest 2.6.9.EL vs. 2.6.9.EL-xen Native
Performance: dbench < 5% Overhead up to 8 way SMP
Kernel build 5% 32b PAE; Parallel make, 4 processes per CPU 8% 13% 18% 23% # Virtual CPUs Source: XenSource, Inc: 10/06
I/O Architecture • Xen IO-Spaces delegate guest OSes protected access to specified h/w devices • Virtual PCI configuration space • Virtual interrupts • (Need IOMMU for full DMA protection) • Devices are virtualised and exported to other VMs via Device Channels • Safe asynchronous shared memory transport • ‘Backend’ drivers export to ‘frontend’ drivers • Net: use normal bridging, routing, iptables • Block: export any blk dev e.g. sda4,loop0,vg3 • (Infiniband / Smart NICs for direct guest IO)
Isolated Driver Domains VM0 VM1 VM2 VM3 Device Manager & Control s/w Unmodified User Software Unmodified User Software Driver Domain GuestOS (XenLinux) GuestOS (XenLinux) GuestOS (XenLinux) GuestOS (XenBSD) Back-End Back-End Native Device Driver Native Device Driver Front-End Device Drivers Front-End Device Drivers Virtual CPU Virtual MMU Control IF Safe HW IF Event Channel Xen Virtual Machine Monitor Hardware (SMP, MMU, physical memory, Ethernet, SCSI/IDE)
Isolated Driver VMs • Run device drivers in separate domains • Detect failure e.g. • Illegal access • Timeout • Kill domain, restart • E.g. 275ms outage from failed Ethernet driver 350 300 250 200 150 100 50 0 0 5 10 15 20 25 30 35 40 time (s)
Hardware Virtualization (1) • Paravirtualization… • has fundamental benefits… (c/f MS Viridian) • but is limited to OSes with PV kernels. • Recently seen new CPUs from Intel, AMD • enable safe trapping of ‘difficult’ instructions • provide additional privilege layers (“rings”) • currently shipping in most modern server, desktop and notebook systems • Solves part of the problem, but…
Hardware Virtualization (2) • CPU is only part of the system • also need to consider memory and I/O • Memory: • OS wants contiguous physical memory, but Xen needs to share between many OSes • Need to dynamically translate between guest physical and ‘real’ physical addresses • Use shadow page tables to mirror guest OS page tables (and implicit ‘no paging’ mode) • Xen 3.0 includes software shadow page tables; future x86 processors will include hardware support.
Hardware Virtualization (3) • Finally we need to solve the I/O issue • non-PV OSes don’t know about Xen • hence run ‘standard’ PC ISA/PCI drivers • Just emulate devices in software? • complex, fragile and non-performant… • … but ok as backstop mechanism. • Better: • add PV (or “enlightened”) device drivers to OS • well-defined driver model makes this relatively easy • get PV performance benefits for I/O path
Xen 3: Hardware Virtual Machines • Enable Guest OSes to be run without modification • E.g. legacy Linux, Solaris x86, Windows XP/2003 • CPU provides vmexits for certain privileged instrs • Shadow page tables used to virtualize MMU • Xen provides simple platform emulation • BIOS, apic, iopaic, rtc, net (pcnet32), IDE emulation • Install paravirtualized drivers after booting for high-performance IO • Possibility for CPU and memory paravirtualization • Non-invasive hypervisor hints from OS
Control Interface Scheduler Event Channel Hypercalls Processor Memory I/O: PIT, APIC, PIC, IOAPIC HVM Architecture Domain 0 Domain N Guest VM (HVM) (64-bit mode) Guest VM (HVM) (32-bit mode) Linux xen64 3D Control Panel (xm/xend) Unmodified OS Unmodified OS Device Models 3P Linux xen64 Front end Virtual Drivers Backend Virtual driver Guest BIOS Guest BIOS 0D Native Device Drivers Native Device Drivers 1/3P Virtual Platform Virtual Platform VMExit VMExit Callback / Hypercall Event channel 0P
Progressive Paravirtualization • Hypercall API available to HVM guests • Selectively add PV extensions to optimize • Network and Block IO • XenAPIC (event channels) • MMU operations • multicast TLB flush • PTE updates (faster than page fault) • page sharing • Time (wall-clock and virtual time) • CPU and memory hotplug
Control Interface Scheduler Event Channel Hypercalls Processor Memory I/O: PIT, APIC, PIC, IOAPIC Xen 3.0.3 Enhanced HVM I/O Domain 0 Domain N Guest VM (HVM) (32-bit mode) Guest VM (HVM) (64-bit mode) Linux xen64 Control Panel (xm/xend) Unmodified OS Unmodified OS 3D Device Models 3P Linux xen64 FE Virtual Drivers FE Virtual Drivers Front end Virtual Drivers Backend Virtual driver Guest BIOS Guest BIOS 0D Native Device Drivers Native Device Drivers 1/3P Virtual Platform Virtual Platform VMExit VMExit Callback / Hypercall PIC/APIC/IOAPIC emulation Event channel 0P
HVM I/O Performance Measured with ttcp (1500 byte MTU) Source: XenSource, Sep 06 Emulated I/O PV on HVM Pure PV
Control Interface Scheduler Event Channel Hypercalls Processor Memory I/O: PIT, APIC, PIC, IOAPIC Future plan: I/O stub domains. Guest VM (HVM) (64-bit mode) Guest VM (HVM) (32-bit mode) Domain 0 Domain N Linux xen64 Unmodified OS Unmodified OS Control Panel (xm/xend) 3D Device Models FE Virtual Drivers FE Virtual Drivers 3P Linux xen64 Front end Virtual Drivers Guest BIOS Guest BIOS Backend Virtual driver Virtual Platform Virtual Platform 0D Native Device Drivers Native Device Drivers 1/3P VMExit VMExit IO Emulation IO Emulation Callback / Hypercall PIC/APIC/IOAPIC emulation Event channel 0P
HW Virtualization Summary • CPU virtualization available today • lets Xen support legacy/proprietary OSes • Additional platform protection imminent • protect Xen from IO devices • full IOMMU extensions coming soon • MMU virtualization also coming soon: • avoid the need for s/w shadow page tables • should improve performance and reduce complexity • Device virtualization arriving from various folks: • networking already here (ethernet, infiniband) • [remote] storage in the works (NPIV, VSAN) • graphics and other devices sure to follow…
What is XenEnterprise? “Ten minutes to Xen” • Multi-Operating System • Windows, Linux and Solaris • Bundled Management Console • Easy to use • Xen and guest installers and P2V tools • For standard servers and blades • High Performance Paravirtualization • Exploits hardware virtualization • Per guest resource guarantees • Extensible Architecture • Secure, tiny, low maintenance • Extensible by ecosystem partners
Get Started with XenEnterprise • Packaged and supported virtualization platform for x86 servers • Includes the XenTM Hypervisor • High performance bare metal virtualization for both Windows and Linux guests • Easy to use and install • Management console included for standard management of Xen systems and guests • Microsoft supports Windows customers on XenEnterprise • Download free from www.xensource.com and try it out! “Ten minutes to Xen”
A few XE 3.2 Screenshots… Resource usage statistics Windows 2003 Server Windows XP Easy VM Creation Red Hat Linux 4 Clone and Export VMs
Performance: Conclusions • Xen PV guests typically pay ~1% (1VCPU) or ~2% (2VCPU) compared to native • ESX 3.0.1 pays 12-21% for same benchmark • XenEnterprise includes: • hardened and optimized OSS Xen • proprietary PV drivers for MS OSes • matches or beats ESX performance in nearly all cases • Some room for further improvement…
Live Migration of VMs: Motivation • VM migration enables: • High-availability • Machine maintenance • Load balancing • Statistical multiplexing gain Xen Xen
Assumptions • Networked storage • NAS: NFS, CIFS • SAN: Fibre Channel • iSCSI, network block dev • drdb network RAID • Good connectivity • common L2 network • L3 re-routeing Xen Xen Storage
Challenges • VMs have lots of state in memory • Some VMs have soft real-time requirements • E.g. web servers, databases, game servers • May be members of a cluster quorum • Minimize down-time • Performing relocation requires resources • Bound and control resources used
Relocation Strategy VM active on host A Destination host selected (Block devices mirrored) Stage 0: pre-migration Initialize container on target host Stage 1: reservation Copy dirty pages in successive rounds Stage 2: iterative pre-copy Suspend VM on host A Redirect network traffic Synch remaining state Stage 3: stop-and-copy Activate on host B VM state on host A released Stage 4: commitment