NFLUG Xen Presentation

35
Xen Virtualization Niagara Frontier LUG May 2008 Erek Dyskant

Transcript of NFLUG Xen Presentation

Page 1: NFLUG Xen Presentation

Xen VirtualizationXen Virtualization

Niagara Frontier LUGMay 2008

Erek Dyskant

Niagara Frontier LUGMay 2008

Erek Dyskant

Page 2: NFLUG Xen Presentation

VirtualizationVirtualization

Separation of administrative zonesSeparation of software failureConsolidation of hardware resources

Full utilization of hardwareEasier hardware provisioning -- Want a server? You’ve got a server.

Excellent test environments

Separation of administrative zonesSeparation of software failureConsolidation of hardware resources

Full utilization of hardwareEasier hardware provisioning -- Want a server? You’ve got a server.

Excellent test environments

Page 3: NFLUG Xen Presentation

What virtualization isn’t

What virtualization isn’t Not an HA solution by itself

Naïve Implementation: Not suitable for some secure applications

Timing of private keysUnknown -- Lots of new codeHost OS adds a new point of entry

May actually increase complexityAdds Host OSes to manageAdds to total number of points of managementEncourages “guerilla” server projects

Not an HA solution by itself Naïve Implementation: Not suitable for some secure applications

Timing of private keysUnknown -- Lots of new codeHost OS adds a new point of entry

May actually increase complexityAdds Host OSes to manageAdds to total number of points of managementEncourages “guerilla” server projects

Mail Web Directory

DatabaseMail

Web

Directory

Database

Page 4: NFLUG Xen Presentation

Container Virtualization

Container Virtualization

Works at the kernel level, masking processes running on other partitions.

All guests share the same filesystem tree. Same kernel on all machines Unprivileged VMs can’t mount drives or change network settings

Native Speeds, no emulation overhead Any OS Crash effects all machines OpenVZ, Virtuozzo, Solaris Containers, FreeBSD Jails, Linux-Vserver

Works at the kernel level, masking processes running on other partitions.

All guests share the same filesystem tree. Same kernel on all machines Unprivileged VMs can’t mount drives or change network settings

Native Speeds, no emulation overhead Any OS Crash effects all machines OpenVZ, Virtuozzo, Solaris Containers, FreeBSD Jails, Linux-Vserver

Page 5: NFLUG Xen Presentation

Full VirtualizationFull Virtualization

Hardware Virtual MachinesVMWare, Xen HVM, KVM, Microsoft VM, Parallels

Runs unmodified guestsGenerally worst performance, but often acceptable

Simulates bios, communicates with VMs through ACPI emulation, BIOS emulation, sometimes custom drivers

Can sometimes virtualize accross architectures, although this is out of fashion.

Hardware Virtual MachinesVMWare, Xen HVM, KVM, Microsoft VM, Parallels

Runs unmodified guestsGenerally worst performance, but often acceptable

Simulates bios, communicates with VMs through ACPI emulation, BIOS emulation, sometimes custom drivers

Can sometimes virtualize accross architectures, although this is out of fashion.

Page 6: NFLUG Xen Presentation

VMWare ServerVMWare Server

Very well-developed GUIDecent PerformanceExcellent DocumentationBacked by a single vendorFree Version

Very Functional. Easy setup.No server-server communication/failover or supported shared storage

Non-free VersionShared Storage, centralized management, automated provisioning.

Very well-developed GUIDecent PerformanceExcellent DocumentationBacked by a single vendorFree Version

Very Functional. Easy setup.No server-server communication/failover or supported shared storage

Non-free VersionShared Storage, centralized management, automated provisioning.

Page 7: NFLUG Xen Presentation

VMWare Server 2VMWare Server 2

Page 8: NFLUG Xen Presentation

Para-virtualizationPara-virtualization Hypervisor runs on the bare metal. Handles CPU

scheduling and memory compartmentalization. Dom0, a modified Linux Kernel, handles

networking and block storage for all guests. Dom0 is also privileged to manage the VMs on the

system. DomU, or the guests OS, sends some requests

straight to the hypervisor, and others to the Dom0.

Because the kernel knows its virtualized, features can be built into it: hot connection/disconnection of resources, friendly shutdown, serial console.

Other paravirtualization schemes: Sun Logical Domains, VMware (sometimes)

Hypervisor runs on the bare metal. Handles CPU scheduling and memory compartmentalization.

Dom0, a modified Linux Kernel, handles networking and block storage for all guests. Dom0 is also privileged to manage the VMs on the

system. DomU, or the guests OS, sends some requests

straight to the hypervisor, and others to the Dom0.

Because the kernel knows its virtualized, features can be built into it: hot connection/disconnection of resources, friendly shutdown, serial console.

Other paravirtualization schemes: Sun Logical Domains, VMware (sometimes)

Page 9: NFLUG Xen Presentation

Elements of a Xen VMElements of a Xen VM

Virtual Block DeviceImage fileReal block device (either LVM or physical)

Network BridgesRouted, terminates at the Dom0Bridged, terminates at the network interface

Virtual FramebufferVNC Server

Virtual Block DeviceImage fileReal block device (either LVM or physical)

Network BridgesRouted, terminates at the Dom0Bridged, terminates at the network interface

Virtual FramebufferVNC Server

Page 10: NFLUG Xen Presentation

Example VM ConfigExample VM Config

name = ”DomU-1"maxmem = 512memory = 512vcpus = 2bootloader = "/usr/bin/pygrub"on_poweroff = "destroy"on_reboot = "restart"on_crash = "restart"vfb = [ "type=vnc,vncunused=1,keymap=en-us" ]disk = [

"tap:aio:/var/lib/xen/images/Centos5Image.img,xvda,w" ]vif = [ "mac=00:16:3e:79:fd:8d,bridge=xenbr0" ]

name = ”DomU-1"maxmem = 512memory = 512vcpus = 2bootloader = "/usr/bin/pygrub"on_poweroff = "destroy"on_reboot = "restart"on_crash = "restart"vfb = [ "type=vnc,vncunused=1,keymap=en-us" ]disk = [

"tap:aio:/var/lib/xen/images/Centos5Image.img,xvda,w" ]vif = [ "mac=00:16:3e:79:fd:8d,bridge=xenbr0" ]

Page 11: NFLUG Xen Presentation

xm -- Xen Managerxm -- Xen Manager

Commandline tool on Dom0 for managing vms.

Quick overview of options: console -- attach to a device’s console create -- boot a DomU from a config file destroy -- immediately stop a DomU list -- List running DomUs migrate -- Migrate a console to another Dom0 pause/unpause -- akin to suspend. TCP connections will timeout shutdown -- Tell a DomU to shut down. network-attach/network-detach block-attach/block-detach

Commandline tool on Dom0 for managing vms.

Quick overview of options: console -- attach to a device’s console create -- boot a DomU from a config file destroy -- immediately stop a DomU list -- List running DomUs migrate -- Migrate a console to another Dom0 pause/unpause -- akin to suspend. TCP connections will timeout shutdown -- Tell a DomU to shut down. network-attach/network-detach block-attach/block-detach

Page 12: NFLUG Xen Presentation

Redhat/Centos virt-manager

Redhat/Centos virt-manager

Simple Graphical Interface.Basically does what xm does, plus:

Built in short-term performance graphing

Built in VNC clientQuick tour...

Simple Graphical Interface.Basically does what xm does, plus:

Built in short-term performance graphing

Built in VNC clientQuick tour...

Page 13: NFLUG Xen Presentation

Main ViewMain View

Page 14: NFLUG Xen Presentation

Create VMCreate VM

Page 15: NFLUG Xen Presentation

Name MachineName Machine

Page 16: NFLUG Xen Presentation

Choose MethodChoose Method

Page 17: NFLUG Xen Presentation

Choose Media LocationChoose Media Location

Page 18: NFLUG Xen Presentation

Networking ConfigNetworking Config

Page 19: NFLUG Xen Presentation

Memory, CPU allocationMemory, CPU allocation

Page 20: NFLUG Xen Presentation

Confirmation ScreenConfirmation Screen

Page 21: NFLUG Xen Presentation

VNC WindowVNC Window

Page 22: NFLUG Xen Presentation

Graph ViewGraph View

Page 23: NFLUG Xen Presentation

BenchmarksBenchmarks

Small Images

0

2000

4000

6000

8000

10000

12000

14000

Small Images

Moodle

90

95

100

105

110

115

120

125

Moodle

Kilobytes / Second

Bare Machine

Xen Image

Xen Device

VMWare

Page 24: NFLUG Xen Presentation

More BenchmarksMore BenchmarksMysql Benchmark Suite

248202 203 214

309

198

266 275

480

544 558

384

864

676 676

767

271

200 219 217

0

100

200

300

400

500

600

700

800

900

1000

VMWare Xen Image Xen Partition Hardware

Seconds to Completion

countcreate-deletinsertselectupdate

Page 25: NFLUG Xen Presentation

Xen Live MigrationXen Live MigrationMigrate machines off during upgrades or balance load

Set xend.conf to allow migration from other xen Dom0s.

Machine must reside on shared storage.

Must be on the same level2 networkxm migrate -l Machine dest.ip.addr.ess

Migrate machines off during upgrades or balance load

Set xend.conf to allow migration from other xen Dom0s.

Machine must reside on shared storage.

Must be on the same level2 networkxm migrate -l Machine dest.ip.addr.ess

Page 26: NFLUG Xen Presentation

Shared Storage OptionsShared Storage Options

NFSSimple hardware failoverwell-understood configurationSpotty reliability history

Block level storage (iscsi or FC)More complex configurationMultipathingCommercial solutions are expensiveWe’re seeing traction for open iscsi lately.

NFSSimple hardware failoverwell-understood configurationSpotty reliability history

Block level storage (iscsi or FC)More complex configurationMultipathingCommercial solutions are expensiveWe’re seeing traction for open iscsi lately.

Page 27: NFLUG Xen Presentation

What to Look for In Storage

What to Look for In Storage

Redundant host connectionsSnapshottingReplicationSensible Volume ManagementThin ProvisioningIP-based failover, esp. if x86 based

Redundant host connectionsSnapshottingReplicationSensible Volume ManagementThin ProvisioningIP-based failover, esp. if x86 based

Page 28: NFLUG Xen Presentation

Storage SystemsStorage Systems OpenFiler

Nice fronted.Replication with DRBDiscsi with linux iscsi-target

OpenSolaris/ZFSThin provisioningToo many ZFS features to listStorageTek AVS -- Replication in may formsComplex configuration

NexentaStorZFS/AVS in Debian.Rapidly Evolving

SAN/IQ Failover, storage virtualization, n(y) redundancyExpensive and wickedly strict licensing

Too Many propriety hardware systems to list

OpenFilerNice fronted.Replication with DRBDiscsi with linux iscsi-target

OpenSolaris/ZFSThin provisioningToo many ZFS features to listStorageTek AVS -- Replication in may formsComplex configuration

NexentaStorZFS/AVS in Debian.Rapidly Evolving

SAN/IQ Failover, storage virtualization, n(y) redundancyExpensive and wickedly strict licensing

Too Many propriety hardware systems to list

Page 29: NFLUG Xen Presentation

Network SegmentationNetwork Segmentation

802.1q VLAN taggingAll VLANs operate on the same physical network, but packets carry an extra tag that indicates which network they belong in.

Create an interface and a bridge for each vlan.

Connect Xen DomUs to their appropriate vlanConfigure host’s switch ports as vlan trunk ports.

Configure router somewhere, or a layer 3 switch is useful here.

802.1q VLAN taggingAll VLANs operate on the same physical network, but packets carry an extra tag that indicates which network they belong in.

Create an interface and a bridge for each vlan.

Connect Xen DomUs to their appropriate vlanConfigure host’s switch ports as vlan trunk ports.

Configure router somewhere, or a layer 3 switch is useful here.

Page 30: NFLUG Xen Presentation

Commercial XensCommercial Xens

Citrix XenServerOracle VMVirtualIron

Typical Features:Resource QoSPerformance trendingPhysical Machine Failure detectionPretty GUI!API for server provisioning

Citrix XenServerOracle VMVirtualIron

Typical Features:Resource QoSPerformance trendingPhysical Machine Failure detectionPretty GUI!API for server provisioning

Page 31: NFLUG Xen Presentation

Recovery strategiesRecovery strategies

Mount virtual block device on Dom0losetup /dev/loop0 XenVBlockImage.imglosetup -akpartx -a /dev/loop0pvscan (if using LVM inside VM)vgchange -a y VolGroup00mount /dev/mapper/VolGroup00-LogVol00 /mnt/xen

chroot /mnt/xen (or whatever recovery steps you take next)

Mount virtual block device on Dom0losetup /dev/loop0 XenVBlockImage.imglosetup -akpartx -a /dev/loop0pvscan (if using LVM inside VM)vgchange -a y VolGroup00mount /dev/mapper/VolGroup00-LogVol00 /mnt/xen

chroot /mnt/xen (or whatever recovery steps you take next)

Page 32: NFLUG Xen Presentation

Xen Recovery -- contXen Recovery -- cont

Boot from recovery CD as HVMdisk = [

’tap:aio:/home/xen/domains/damsel.img,ioemu:hda,w','file:/home/jack/knoppix.iso,ioemu:hdc:cdrom,r' ]builder="hvm"extid=0device_model="/usr/lib/xen/bin/qemu-dm"kernel="/usr/lib/xen/boot/hvmloader"boot="d"vnc=1vncunused=1apic=0acpi=1

Create custom Xen Kernel OS image for rescues

Boot from recovery CD as HVMdisk = [

’tap:aio:/home/xen/domains/damsel.img,ioemu:hda,w','file:/home/jack/knoppix.iso,ioemu:hdc:cdrom,r' ]builder="hvm"extid=0device_model="/usr/lib/xen/bin/qemu-dm"kernel="/usr/lib/xen/boot/hvmloader"boot="d"vnc=1vncunused=1apic=0acpi=1

Create custom Xen Kernel OS image for rescues

Page 33: NFLUG Xen Presentation

PitfallsPitfalls

Failure to segregate network802.1q and iptables firewalls everywhere

Creating Single Points of FailureMake sure that VMs are clusteredIf they can’t be clustered, auto started on another machine

Assess reliability of shared storageStorage BottlenecksNot planning for extra points of managementcfengine, puppet, centralized authentication

Less predictable performance modeling

Failure to segregate network802.1q and iptables firewalls everywhere

Creating Single Points of FailureMake sure that VMs are clusteredIf they can’t be clustered, auto started on another machine

Assess reliability of shared storageStorage BottlenecksNot planning for extra points of managementcfengine, puppet, centralized authentication

Less predictable performance modeling

Page 34: NFLUG Xen Presentation

Maintaining HAMaintaining HAHardware will failIndividual VMs will crashCluster Multiple VMs for each application

Load Balancers can be VMs too.

Hardware will failIndividual VMs will crashCluster Multiple VMs for each application

Load Balancers can be VMs too.

Page 35: NFLUG Xen Presentation

HA -- ContinuedHA -- ContinuedFailure Detection, make VM restart on different machines if a machine fails

Make VMs migrate off a host when you shut it down

Build your testing system into the VM scheme.At least one testing system per type of host. Diligently do all changes on that before rolling out.

Have at least one development VM per VM cluster.Make sure that networking equipment and storage is redundant too

If running web servers, keep a physical web server on hand to serve a “We’re sorry, come back later” page. For mail servers, an independant backup MX.

Failure Detection, make VM restart on different machines if a machine fails

Make VMs migrate off a host when you shut it down

Build your testing system into the VM scheme.At least one testing system per type of host. Diligently do all changes on that before rolling out.

Have at least one development VM per VM cluster.Make sure that networking equipment and storage is redundant too

If running web servers, keep a physical web server on hand to serve a “We’re sorry, come back later” page. For mail servers, an independant backup MX.