KVM vs Xen
【Xen 和 KVM 雙方辯論會】
- Xen: 我效能很好勒
- KVM: 我都不用 Patch Kernel 勒
【特性比較】
使用的虛擬化技術 | 優點 | 與 Kernel 整合性 | 與硬體相依性 | 背後老大 | |
Xen | ParaVirtualization Full Virtualization(需有 CPU 硬體支援) | CPU 效能佳 | Guest 於 2.6.23 整合進 Kernel 但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) 支援 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 | Help | |
Phoronix Test Suite - Kernel Compilation | 2304.17 secs | 2885.10 secs | 3228.48 secs | Fewer are better |
Phoronix Test Suite - FFmpeg | 20.87 secs | 20.96 secs | 21.79 sces | Fewer are better |
Phoronix Test Suite - Wavpack | 17.34 secs | 18.16 secs | 18.78 secs | Fewer are better |
XenPV01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Para-Virtualization)
XenHVM01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Full Virtualization)
KVMhvm01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: KVM Full Virtualization)
小結: Xen Para-Virtualization 有最佳的效能, Full Virtualization 也是 Xen-HVM 最佳 (Xen-PV > Xen-HVM > KVM-HVM)
2. Memory 效能比較
Xen-PV | Xen-HVM | KVM-HVM | Help | |
Phoronix Test Suite - CacheBench | Read: 2026.32 MB/s Write: 7995.89 MB/s Read/Modify/Write: 16612.87 MB/s | Read: 2020.17 MB/s Write: 8338.78 MB/s Read/Modify/Write: 16564.89 MB/s | Read: 2008.86 MB/s Write: 7940.70 MB/s Read/Modify/Write: 16436.59 MB/s | More is better |
Phoronix Test Suite - RAMspeed | Integer: 3934.79 MB/s Floating Point: 3961.87 MB/s | Integer: 3663.37 MB/s Floating Point: 3688.82 MB/s | Integer: 3872.83 MB/s Floating Point: 3910.84 MB/s | More is better |
XenPV01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Para-Virtualization)
XenHVM01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Full Virtualization)
KVMhvm01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: KVM Full Virtualization)
小結: Xen Para-Virtualization 有最佳的效能, Full Virtualization 則是 KVM-HVM 在浮點運算上優於 Xen-HVM
3. Disk I/O 效能比較
- 註:Xen 可選擇 file、tap:aio 和 xen4.0 最新 tap:tapdisk:aio 來設定 Guest disk
- 註:KVM 可使用 virtio 來增加 I/O 效能 (KVM >= 60, kernel >=2.6.25)
- Virtualized Block Device I/O Performance
- 樓上那位大大的 Disk I/O 測試總結:
- (1) Xen is actually pretty damn good
(2) KVM performance is sorry with full device emulation (expected)
(3) KVM+VirtIO is better, but nowhere near Xen Paravirt
Xen-PV | Xen-HVM | KVM-HVM | Help | |
Phoronix Test Suite - dbench | ClientCount128: 19.84 MB/s | ClientCount128: 11.56 MB/s | ClientCount128: 4.09 MB/s | More is better |
Phoronix Test Suite - IOzone | Write1MB4GB: 14.27 MB/s Read1MB4GB: 13.14 MB/s | Write1MB4GB: 9.77 MB/s Read1MB4GB: 27.24 MB/s | Write1MB4GB: 8.22 MB/s Read1MB4GB: 8.06 MB/s | More is better |
Phoronix Test Suite - Thread I/O | Count32-256MB: 0.43 MB/s | Count32-256MB: 0.17 MB/s | Count32-256MB: 0.24 MB/s | More is better |
XenPV01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Para-Virtualization)
XenHVM01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Full Virtualization)
KVMhvm01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: KVM Full Virtualization)
小結: Xen Para-Virtualization 在大部分的情況下擁有最佳的效能,但是 Xen-HVM 在大檔案讀取上特別優於 Xen-PV & KVM-HVM.
另外在 Full Virtualization 上 KVM-HVM 在大檔案的計算上較 Xen-HVM 稍微來的優.
4. Network I/O 效能比較
- KVM developers achieve native network IO performance
- 此位大大的測試,使用 KVM PCI-passthrough 配合 Intel VT-d 可達到 Host 相同的網路效能
- 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)
XenHVM01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Full Virtualization)
KVMhvm01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: KVM Full Virtualization)
5. Graphics 效能比較
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)
XenHVM01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: Xen Full Virtualization)
KVMhvm01 規格 = 1 CPU + 10GB HD + 1GB RAM + 500MB SWAP (說明: 虛擬機器數量一台: KVM Full Virtualization)
【總結】
【Reference】
- Benchmarks: Core i7 vs Core 2 Duo vs Virtual Machine
- Virtual Machine Benchmark
- Open Source Performance test tools
- Phoronix Test Suite
- Configuring and Installing a Xen Hardware Virtual Machine (HVM) domainU Guest
- KVM Virtualization With KVM On A Debian Lenny Server
- Using kvm, or kqemu, to speed up qemu
- CUDA Toolkit Download
- Xen 和 KVM 的性能对比
Attachments (3)
- Migrating-from-UML-to-Xen-and-Kernel-Based-Virtual-Machines.pdf (1.3 MB) - added by rock 14 years ago.
- Quantitative Comparison of Xen and KVM.pdf (178.4 KB) - added by rock 14 years ago.
- Direct Access to Graphics Card Leveraging VT-d Technical Report.pdf (162.3 KB) - added by rock 14 years ago.
Download all attachments as: .zip