From 45dab34513022a903879c7caeb6b80e9c69be7c7 Mon Sep 17 00:00:00 2001 From: Aurelien Jarno Date: Fri, 11 Mar 2016 16:46:15 +0100 Subject: [PATCH] Ganeti howto: add a section about how to change the CPU type Signed-off-by: Aurelien Jarno --- input/howto/install-ganeti.creole | 82 +++++++++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/input/howto/install-ganeti.creole b/input/howto/install-ganeti.creole index 3af7113..d18ef4b 100644 --- a/input/howto/install-ganeti.creole +++ b/input/howto/install-ganeti.creole @@ -467,3 +467,85 @@ Order is important, or else things get very, very confused and the world needs a {{{ gnt-cluster command "echo 1 > /sys/bus/pci/devices/0000:0e:00.0/cciss0/rescan" }}} + +=== Change the CPU type === + +Modern processors come with a wide variety of additional instruction sets (SSE, AES-NI, etc.) which vary from processor to processor, but can greatly improve the performance depending on the workload. Ganeti and QEMU default to a compatible subset of cpu features called qemu64, so that if the host processor is changed, or a live migration is performed, the guest will see its CPUfeatures unchanged. This is great for compatibility but comes at a performance cost. + +The CPU presented to the guests can easily be changed, using the cpu_type option in Ganeti hypervisor options. However to still be able to live-migrate VMs from one host to another, the CPU presented to the guest should be the common denominator of all hosts in the cluster. Otherwise a live migration between two different CPU types could crash the instance. + +For homogeneous clusters it is possible to use the host cpu type: + +{{{ + gnt-cluster modify -H kvm:cpu_type='host' +}}} + +Otherwise QEMU provides a set of generic CPU for each generation, that can be queried that way: + +{{{ +$ qemu-system-x86_64 -cpu ? + +x86 qemu64 QEMU Virtual CPU version 2.1.2 +x86 phenom AMD Phenom(tm) 9550 Quad-Core Processor +x86 core2duo Intel(R) Core(TM)2 Duo CPU T7700 @ 2.40GHz +x86 kvm64 Common KVM processor +x86 qemu32 QEMU Virtual CPU version 2.1.2 +x86 kvm32 Common 32-bit KVM processor +x86 coreduo Genuine Intel(R) CPU T2600 @ 2.16GHz +x86 486 +x86 pentium +x86 pentium2 +x86 pentium3 +x86 athlon QEMU Virtual CPU version 2.1.2 +x86 n270 Intel(R) Atom(TM) CPU N270 @ 1.60GHz +x86 Conroe Intel Celeron_4x0 (Conroe/Merom Class Core 2) +x86 Penryn Intel Core 2 Duo P9xxx (Penryn Class Core 2) +x86 Nehalem Intel Core i7 9xx (Nehalem Class Core i7) +x86 Westmere Westmere E56xx/L56xx/X56xx (Nehalem-C) +x86 SandyBridge Intel Xeon E312xx (Sandy Bridge) +x86 Haswell Intel Core Processor (Haswell) +x86 Broadwell Intel Core Processor (Broadwell) +x86 Opteron_G1 AMD Opteron 240 (Gen 1 Class Opteron) +x86 Opteron_G2 AMD Opteron 22xx (Gen 2 Class Opteron) +x86 Opteron_G3 AMD Opteron 23xx (Gen 3 Class Opteron) +x86 Opteron_G4 AMD Opteron 62xx class CPU +x86 Opteron_G5 AMD Opteron 63xx class CPU +x86 host KVM processor with all supported host features (only available in KVM mode) + +Recognized CPUID flags: + pbe ia64 tm ht ss sse2 sse fxsr mmx acpi ds clflush pn pse36 pat cmov mca pge mtrr sep apic cx8 mce pae msr tsc pse de vme fpu + hypervisor rdrand f16c avx osxsave xsave aes tsc-deadline popcnt movbe x2apic sse4.2|sse4_2 sse4.1|sse4_1 dca pcid pdcm xtpr cx16 fma cid ssse3 tm2 est smx vmx ds_cpl monitor dtes64 pclmulqdq|pclmuldq pni|sse3 + smap adx rdseed rtm invpcid erms bmi2 smep avx2 hle bmi1 fsgsbase + 3dnow 3dnowext lm|i64 rdtscp pdpe1gb fxsr_opt|ffxsr mmxext nx|xd syscall + perfctr_nb perfctr_core topoext tbm nodeid_msr tce fma4 lwp wdt skinit xop ibs osvw 3dnowprefetch misalignsse sse4a abm cr8legacy extapic svm cmp_legacy lahf_lm + invtsc + pmm-en pmm phe-en phe ace2-en ace2 xcrypt-en xcrypt xstore-en xstore + kvmclock-stable-bit kvm_pv_unhalt kvm_pv_eoi kvm_steal_time kvm_asyncpf kvmclock kvm_mmu kvm_nopiodelay kvmclock + pfthreshold pause_filter decodeassists flushbyasid vmcb_clean tsc_scale nrip_save svm_lock lbrv npt +}}} + +For example on a cluster using both Sandy Bridge and Haswell CPU, the following command can be used: +{{{ + gnt-cluster modify -H kvm:cpu_type='SandyBridge' +}}} + +Here is a typical improvement one can get on the AES openssl benchmarks. + +With the default qemu64 CPU type: +{{{ + type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes + aes-128-cbc 175481.21k 195151.55k 199307.09k 201209.51k 201359.36k + aes-128-gcm 49971.64k 57688.17k 135092.14k 144172.37k 146511.19k + aes-256-cbc 130209.34k 141268.76k 142547.54k 144185.00k 144777.22k + aes-256-gcm 39249.19k 44492.61k 114492.76k 123000.83k 125501.44k + +}}} + +With the SandyBridge CPU type: +{{{ + type 16 bytes 64 bytes 256 bytes 1024 bytes 8192 bytes + aes-128-cbc 376040.16k 477377.32k 484083.37k 391323.31k 389589.67k + aes-128-gcm 215921.26k 592407.87k 777246.21k 836795.39k 835971.75k + aes-256-cbc 309840.39k 328612.18k 330784.68k 324245.16k 328116.91k + aes-256-gcm 160820.14k 424322.20k 557212.50k 599435.61k 610459.65k +}}} -- 2.20.1