在险些所有测试中,KVM 的性能比较宿主机而言低落了1.5%以内,只有两项测试例外。第一个是 7-zip 压缩,比宿主机慢了 2.79%。第二个就奇怪了,我们搭了一个邮件做事器,用 PostMark 测试其性能,结果表明 KVM 竟比宿主机快了4.11%。然后我在两台做事器中重新跑了几遍 PostMark 测试,结果性能差异基本不变,浮动都在最初测试结果的1%以内。由于我对 virtio 的内部机制没有很深的理解,我只能在往后再对这个怪征象进行进一步理解。
Xen 的性能相对宿主机而言差异就比较大了。有3项测试性能低落在2.5%以内,剩下的性能低落率都是 KVM 的2~4倍。PostMark 测试的性能比 KVM 慢了14.41%,这结果令我大吃一惊。重新跑了下测试,性能差还是险些不变,浮动都在最初结果的2%以内。KVM 表现最好的 CPU 测试:MAFFT 对齐测试,是 Xen 表现倒数第二差的。
现在奉上一个简短的总结表:

Best Value
Bare Metal
KVM
Xen
C-Ray
lower
35.35
35.66
36.13
POV-Ray
lower
230.02
232.44
235.89
Smallpt
lower
160
162
167.5
John the Ripper (Blowfish)
higher
3026
2991.5
2856
John the Ripper (DES)
higher
7374833.5
7271833.5
6911167
John the Ripper (MD5)
higher
49548
48899.5
46653.5
OpenSSL
higher
397.68
393.95
388.25
7-Zip
higher
12467.5
12129.5
11879
Timed MAFFT Alignment
lower
7.78
7.795
8.42
CLOMP
higher
3.3
3.285
3.125
PostMark
higher
3667
3824
3205
如果须要完全数据,请查看Goole Docs 电子表格。
结论基于上面的测试环境,KVM 的性能损耗险些都在2%以内,Xen 则在十多项测试中有3项损耗在2.5%以内,而其他几项损耗都在5~7%之间。虽然 KVM 在 PostMark 测试中性能表现精良,但这是浩瀚测试中仅有的一项 I/O 测试,如果想证明 KVM 确实在 I/O 处理方面很刁悍,就须要更多测试。
2.3 更多的测试报告http://www.phoronix.com/scan.php?page=article&item=intel_haswell_virtualization&num=1
https://blog.xenproject.org/2011/11/29/baremetal-vs-xen-vs-kvm-redux/
http://www.infoq.com/cn/news/2014/09/kvm-vs-xen
http://flymanhi.blog.51cto.com/1011558/1112363
在经由综合测试后,不论是单个parallel还是两个parallel,xen的跑分测试都比kvm要好。
三种虚拟化性能比较 LXC>>KVM>>XEN (由于LXC利用cgroup机制,其性能破坏基本为0。)三种虚拟化隔离比较 XEN>>KVM>>LXC (LXC只能虚拟化linux)三种虚拟化内存利用率 LXC>>KVM>>XEN (由于LXC共用内核,内存利用率最高;其他两种方案每个虚机都须要单独的操作系统占用一部分内存空间。)
从运算性能和磁盘负载角度来说Linux KVM不失落为最快的虚拟化办理方案。比较之下,VirtualBox在测试中排名第二,而Xen在HVM模式下的虚拟化表现最差。
综上:比较故意思的是这些测试报告的结论都不太一样乃至是相反的。
3. 产方支持如果以上产品我们不打算买厂商支持,个中vmware和hyper-v,是不建议利用的,紧张是授权问题。
这时就剩下kvm和xen了,如果虚拟windows,建议利用 kvm,我们可以从 redhat那里免费拿到针对 windows 优化过的磁盘和网络的驱动 程序,可以达到较高的性能(险些与hyper-v性能持平)。
而xen的 windows 优化驱动不是那么随意马虎就能拿到的(由于redhat往后不支持 xen了,看看novell是否放水了,呵呵,就开放程度上来讲,redhat要好于novell)。
4. 特性比较Attribute
Zones
Xen
KVM
CPU Performance
high
high (with CPU support)
high (with CPU support)
CPU Allocation
flexible (FSS + “bursting”)
fixed to VCPU limit
fixed to VCPU limit
I/O Throughput
high (no intrinsic overhead)
low or medium (with paravirt)
low or medium (with paravirt)
I/O Latency
low (no intrinsic overhead)
some (I/O proxy overhead)
some (I/O proxy overhead)
Memory Access Overhead
none
some (EPT/NPT or shadow page tables)
some (EPT/NPT or shadow page tables)
Memory Loss
none
some (extra kernels; page tables)
some (extra kernels; page tables)
Memory Allocation
flexible (unused guest memory used for file system cache)
fixed (and possible double-caching)
fixed (and possible double-caching)
Resource Controls
many (depends on OS)
some (depends on hypervisor)
most (OS + hypervisor)
Observability: from the host
highest (see everything)
low (resource usage, hypervisor statistics)
medium (resource usage, hypervisor statistics, OS inspection of hypervisor)
Observability: from the guest
medium (see everything permitted, incl. some physical resource stats)
low (guest only)
low (guest only)
Hypervisor Complexity
low (OS partitions)
high (complex hypervisor)
medium
Different OS Guests
usually no (sometimes possible with syscall translation)
yes
yes
更多的特性比较:Mechanism
Operating system
License
Available since/between
Features
File system isolation
Copy on Write
Disk quotas
I/O rate limiting
Memory limits
CPU quotas
Network isolation
Nested virtualization
Partition checkpointingand live migration
Root privilege isolation
chroot
most UNIX-likeoperating systems
varies by operating system
1982
Partial[5]
No
No
No
No
No
No
Yes
No
No
Docker
Linux[6]
Apache License 2.0
2013
Yes
Yes
Not directly
Not directly
Yes
Yes
Yes
Yes
No
No
Linux-VServer(security context)
Linux
GNU GPLv2
2001
Yes
Yes
Yes
Yes[7]
Yes
Yes
Partial[8]
?
No
Partial[9]
lmctfy
Linux
Apache License 2.0
2013
Yes
Yes
Yes
Yes[7]
Yes
Yes
Partial[8]
?
No
Partial[9]
LXC
Linux
GNU GPLv2
2008
Yes[10]
Partial. Yes withBtrfs.
Partial. Yes withLVM orDisk quota.
Yes
Yes
Yes
Yes
Yes
No
Yes[10]
OpenVZ
Linux
GNU GPLv2
2005
Yes
No
Yes
Yes[11]
Yes
Yes
Yes[12]
No
Yes
Yes[13]
Virtuozzo
Linux,Windows
Proprietary
July 2000[14]
Yes
Yes
Yes
Yes[15]
Yes
Yes
Yes[12]
?
Yes
Yes
Solaris Containers(Zones)
Solaris,OpenSolaris,Illumos
CDDL
February 2004
Yes
Yes (ZFS)
Yes
Partial. Yes with Illumos.[16]
Yes
Yes
Yes[17]
Partial. Only when top level is a KVM zone (Illumos) or a kz zone (Oracle)
No[18]
Yes[19]
FreeBSD Jail
FreeBSD
BSD License
1998
Yes
Yes (ZFS)
Yes[20]
No
Yes[21]
Yes
Yes
Yes
No
Yes[22]
sysjail
OpenBSD,NetBSD
BSD License
No longer supported, as of March 3, 2009
Yes
No
No
No
No
No
Yes
No
No
?
WPARs
AIX
Proprietary
2007
Yes
No
Yes
Yes
Yes
Yes
Yes[23]
No
Yes[24]
?
HP-UX Containers (SRP)
HPUX
Proprietary
2007
Yes
No
Partial. Yes with logical volumes
Yes
Yes
Yes
Yes
?
Yes
?
iCore Virtual Accounts
Windows XP
Proprietary/Freeware
2008
Yes
No
Yes
No
No
No
No
?
No
?
Sandboxie
Windows
Proprietary/Shareware
2004
Yes
Yes
Partial
No
No
No
Partial
Yes
No
Yes
参考资料:
https://major.io/2014/06/22/performance-benchmarks-kvm-vs-xen/
http://www.path8.net/tn/archives/4994
https://www.cnblogs.com/sammyliu/articles/4390371.html
http://linux.cn/article-3496-1.html