[[PageOutline]] {{{ #!html

KVM vs Xen

}}} ---- = 【Xen 和 KVM 雙方辯論會】 = * Xen: 我效能很好勒 * KVM: 我都不用 Patch Kernel 勒 ---- = 【特性比較】 = || || '''使用的虛擬化技術''' || '''優點''' || '''與 Kernel 整合性''' || '''與硬體相依性''' || '''背後老大''' || || '''Xen''' || !ParaVirtualization[[BR]]Full Virtualization(需有 CPU 硬體支援) || CPU 效能佳 || Guest 於 2.6.23 整合進 Kernel[[BR]]但Host Kernel 仍需自行 Patch || 不一定要 Intel VT-x 或 AMD-V || 於2007年被 Citrix 併購 || || '''KVM''' || Full Virtualization(需有 CPU 硬體支援) || I/O 效能佳 || 2.6.20 已整合進 Kernel (2007/02) || 一定要有 Intel VT-x 或 AMD-V || Qumranet 於2008被 !RedHat 併購 || * 註:Intel 的 VT-x 的指令集為 vmx,AMD 的指令集為 svm * Xen 支援 VT-x、VT-i 和 SVM,KVM 則只支援 VT-x 和 SVM * 註:__CPU 排程__ - Xen 使用自己維護的 BVT(Borrowed Virtual Time)演算法,KVM 則使用 Linux Kernel 本身提供的 CPU 排程演算法 ---- = 【測試環境】 = * __'''硬體規格:'''__ || '''CPU''' || Intel® Core™2 Quad Processor Q6600 (8M Cache, 2.40 GHz, 1066 MHz FSB) [[BR]]支援 Intel VT-x || || '''Ram''' || 4GB || || '''NIC''' || RTL-8169 Gigabit Ethernet 10/100/1000 || || '''VGA''' || NVIDIA !GeForce 9400 GT || || '''Disk''' || SATA Disk 160GB || * __'''軟體規格:'''__ || '''OS''' || Debian Lenny 5.0.5(x86_64) | || '''Kernel''' || 2.6.26-2 || || '''Xen''' || 3.2.1 || || '''KVM''' || 72 || ---- = 【測試案例】 = == 1. CPU 效能比較 == || || '''Xen-PV''' || '''Xen-HVM''' || '''KVM-HVM''' || || '''VMmark''' || || || || || '''Phoronix Test Suite - gmpbench''' || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-20110-28421-27828 Test Result (XenPV01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-22181-29540-10886 Test Result (XenHVM01)] || [ Test Result (KVMhvm01)]|| || '''Phoronix Test Suite - Kernel Compilation''' || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-31384-9313-1284 Test Result (XenPV01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-19623-6900-25869 Test Result (XenHVM01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-12567-27870-13830 Test Result (KVMhvm01)]|| || '''Phoronix Test Suite - FFmpeg''' || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-23172-31616-29601 Test Result (XenPV01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-32388-18022-13772 Test Result (XenHVM01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-1658-3321-13280 Test Result (KVMhvm01)]|| || '''Phoronix Test Suite - Wavpack''' || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-9293-27328-16282 Test Result (XenPV01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-3132-1427-25588 Test Result (XenHVM01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-30177-14022-808 Test Result (KVMhvm01)]|| '''XenPV01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Para-Virtualization)[[BR]] '''XenHVM01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Full Virtualization)[[BR]] '''KVMhvm01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: KVM Full Virtualization)[[BR]] '''小結:''' '''Xen Para-Virtualization 有最佳的效能,Full Virtualization 也是 Xen最佳''' (Xen-PV > Xen-HVM > KVM-HVM) [[BR]] == 2. Memory 效能比較 == || || '''Xen-PV''' || '''Xen-HVM''' || '''KVM-HVM''' || || '''Phoronix Test Suite - !CacheBench''' || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-17228-28619-12297 Test Result (XenPV01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-2678-23281-22791 Test Result (XenHVM01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-6002-19990-17681 Test Result (KVMhvm01)]|| || '''Phoronix Test Suite - RAMspeed''' || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-17090-19073-8785 Test Result (XenPV01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-16139-9561-5991 Test Result (XenHVM01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-7904-28763-26536 Test Result (KVMhvm01)]|| '''XenPV01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Para-Virtualization)[[BR]] '''XenHVM01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Full Virtualization)[[BR]] '''KVMhvm01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: KVM Full Virtualization)[[BR]] '''小結:''' '''Xen Para-Virtualization 有最佳的效能,Full Virtualization 也是 Xen最佳''' (Xen-PV > Xen-HVM > KVM-HVM) [[BR]] == 3. Disk I/O 效能比較 == * 註:Xen 可選擇 file、[http://wiki.xensource.com/xenwiki/blktap tap:aio] 和 xen4.0 最新 [http://wiki.xensource.com/xenwiki/blktap2 tap:tapdisk:aio] 來設定 Guest disk * 註:KVM 可使用 [http://www.linux-kvm.org/page/Virtio virtio] 來增加 I/O 效能 (KVM >= 60, kernel >=2.6.25) * [http://www.scribd.com/doc/14683287/Virtualized-Block-Device-IO-Performance Virtualized Block Device I/O Performance] * 樓上那位大大的 Disk I/O 測試總結: * (1) Xen is actually pretty damn good[[BR]] (2) KVM performance is sorry with full device emulation (expected)[[BR]] (3) KVM+VirtIO is better, but nowhere near Xen Paravirt || || '''Xen-PV''' || '''Xen-HVM''' || '''KVM-HVM''' || || '''Phoronix Test Suite - dbench''' || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-4090-29472-12379 Test Result (XenPV01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-10799-14034-10765 Test Result (XenHVM01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-1348-19511-10220 Test Result (KVMhvm01)]|| || '''Phoronix Test Suite - IOzone''' || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-25757-3381-19744 Test Result (XenPV01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-11974-12648-12687 Test Result (XenHVM01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-24719-2562-18590 Test Result (KVMhvm01)]|| || '''Phoronix Test Suite - Thread I/O''' || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-12043-14077-10149 Test Result (XenPV01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-13047-3688-3494 Test Result (XenHVM01)] || [http://global.phoronix-test-suite.com/index.php?k=profile&u=rider-6400-2161-20996 Test Result (KVMhvm01)]|| '''XenPV01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Para-Virtualization)[[BR]] '''XenHVM01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Full Virtualization)[[BR]] '''KVMhvm01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: KVM Full Virtualization)[[BR]] '''小結:''' '''Xen Para-Virtualization 有最佳的效能,Full Virtualization 也是 Xen最佳''' (Xen-PV > Xen-HVM > KVM-HVM) [[BR]] == 4. Network I/O 效能比較 == * [http://www.linux-kvm.com/content/kvm-developers-achieve-native-network-io-performance KVM developers achieve native network IO performance] * 此位大大的測試,使用 KVM PCI-passthrough 配合 Intel VT-d 可達到 Host 相同的網路效能 * [http://vmstudy.blogspot.com/2010/04/network-performance-test-xenkvm-vt-d.html Network Performance Test Xen/Kvm (VT-d and Para-virt drivers)] * 此位大大的測試看來,同樣使用 Para-virt + VT-d 的話 Xen 還是勝出 || || '''Xen-PV''' || '''Xen-HVM''' || '''KVM-HVM''' || || '''Phoronix Test Suite''' || [ Test Result (XenPV01)] || [ Test Result (XenHVM01)] || [ Test Result (KVMhvm01)]|| '''XenPV01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Para-Virtualization)[[BR]] '''XenHVM01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Full Virtualization)[[BR]] '''KVMhvm01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: KVM Full Virtualization)[[BR]] '''小結:''' [[BR]] == 5. Graphics 效能比較 == * [http://trac.nchc.org.tw/grid/attachment/wiki/KVM_vs_Xen/Direct%20Access%20to%20Graphics%20Card%20Leveraging%20VT-d%20Technical%20Report.pdf Direct Access to Graphics Card Leveraging VT-d Technical Report] || || '''Xen-PV''' || '''Xen-HVM''' || '''KVM-HVM''' || || '''CUDA - GPU-accelerated LAPACK''' || [ Test Result (XenPV01)] || [ Test Result (XenHVM01)] || [ Test Result (KVMhvm01)]|| || '''CUDA - Performance Primitives''' || [ Test Result (XenPV01)] || [ Test Result (XenHVM01)] || [ Test Result (KVMhvm01)]|| || '''Phoronix Test Suite''' || [ Test Result (XenPV01)] || [ Test Result (XenHVM01)] || [ Test Result (KVMhvm01)]|| '''XenPV01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Para-Virtualization)[[BR]] '''XenHVM01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Full Virtualization)[[BR]] '''KVMhvm01 規格''' = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: KVM Full Virtualization)[[BR]] '''小結:''' [[BR]] ---- = 【總結】 = ---- = 【Reference】 = * [http://keithelder.net/blog/archive/2009/04/09/benchmarks-core-i7-vs-core-2-duo-vs-virtual-machine.aspx Benchmarks: Core i7 vs Core 2 Duo vs Virtual Machine] * [http://www.assyoma.it/index.php/knowledgebase/52-benchmark/102-virtual-machine-benchmark Virtual Machine Benchmark ] * [http://www.opensourcetesting.org/performance.php Open Source Performance test tools ] * [http://www.phoronix-test-suite.com/?k=home Phoronix Test Suite ] * [http://www.virtuatopia.com/index.php/Configuring_and_Installating_a_Xen_Hardware_Virtual_Machine_%28HVM%29_domainU_Guest Configuring and Installing a Xen Hardware Virtual Machine (HVM) domainU Guest] * [http://www.howtoforge.com/virtualization-with-kvm-on-a-debian-lenny-server KVM Virtualization With KVM On A Debian Lenny Server] * [http://www.debian-administration.org/articles/545 Using kvm, or kqemu, to speed up qemu] * [http://developer.nvidia.com/object/cuda_3_1_downloads.html CUDA Toolkit Download] * [http://www.vpsee.com/2009/09/xen-vs-kvm-performance-and-scalabilit/ Xen 和 KVM 的性能对比]