Kvm optimizations

2 432 vues

Publié le

0 commentaire
4 j’aime
Statistiques
Remarques
  • Soyez le premier à commenter

Aucun téléchargement
Vues
Nombre de vues
2 432
Sur SlideShare
0
Issues des intégrations
0
Intégrations
5
Actions
Partages
0
Téléchargements
59
Commentaires
0
J’aime
4
Intégrations 0
Aucune incorporation

Aucune remarque pour cette diapositive

Kvm optimizations

  1. 1. CentOS Dojo 2013KVM Optimizations and Best Practices From the Desktop to the Datacenter Jaime Melis (opennebula.org)
  2. 2. Summary● Tools● Drivers● Image Backends● CPU● Memory● Networking● Desktop Sharing● Cloud point-of-view Challenges
  3. 3. Tools● Libvirtd !!!!!!● virt-manager● virt-install● qemu-img● virt-alignment-scan (libguestfs)● lstopo● OpenNebula
  4. 4. Drivers● Easy... use virtio!!!● Huge performance gain● No emulation● Cooperation with the hypervisor● Integrated into the linux kernel
  5. 5. Image Backends● Regular file● Qcow2 – snapshots (beware of the sync!) – additonal layer, less performance – compressed● LVM → block device (san storage)● Virt-alignment-scan● Cache – Writethrough (host page on, guest disk write cache off) – Writeback (host page on, guest disk write cache on) ● Good overall I/O Performance – None (host page off, guest disk write cache on) ● Good write performance
  6. 6. CPU - pinning● NUMA (Non-Uniform Memory Access)● Shared cache ~ 15% improvement● Bad for different tasks● Processor availability● virsh capabilities● lstopo
  7. 7. CPU - pinning<cputune> <vcpupin vcpu="0" cpuset="1-4,^2"/> <vcpupin vcpu="1" cpuset="0,1"/> <vcpupin vcpu="2" cpuset="2,3"/> <vcpupin vcpu="3" cpuset="0,4"/> ...</cputune>
  8. 8. CPU - cgroups● Limit, account and● Bad for different tasks● Processor availability● virsh capabilities● lstopo
  9. 9. CPU - cgroups● Limit, account and isolate resource usage <cputune> <shares>2048</shares> ... </cputune>
  10. 10. CPU - model● Subset of features● Increase performance● Nested virtualization● /usr/share/libvirt/cpu_map.xml <cpu match=exact> <model fallback=allow>core2duo</model> <vendor>Intel</vendor> <topology sockets=1 cores=2 threads=1/> <feature policy=disable name=lahf_lm/> </cpu>
  11. 11. Memory - KSM● Kernel Samepage Merging● Combines memory private pages● Very useful for VMs !!!!● Increases VM density● Enable by default
  12. 12. Networking7● MacVTap (direct)... NO!● Bridged networking... way to go!● Disable STP● Optimal configuration● NAT (masquerading)● iptables
  13. 13. Desktop Sharing● VNC● SPICE – qlx driver – Redirect printers – Usb (mass-storage) – Audio
  14. 14. Cloud Challenges● Virt-manager + LVM + DHCP => 10 hosts● Live-migration to any host● Image layout – dont waste space● Contextualization: install once and deploy many● Network Isolation● Mac/IP spoofing● Multi-tenancy
  15. 15. Cloud Challenges - ebtables● Isolate● Prevent mac spoofing # Drop packets that dont match the networks MAC Address -s ! <mac_address>/ff:ff:ff:ff:ff:0 -o <tap_device> -j DROP # Prevent MAC spoofing -s ! <mac_address> -i <tap_device> -j DROP
  16. 16. Cloud Challenges – What storage?● No Storage Holy Grail LVM2 iSCSI Qcow2 + DFS Provisioning time + ++ +++ I/O ++ ++ + Network ++ +++ + Snapshotting - - + Livemigration + - +
  17. 17. Thanks for attending!jmelis - #opennebula @Freenode

×