收费和免费:
因此:
结论:
虚拟windows,如果都能得到厂商的支持,那么,性能优化可以不用担心。这几款软件全都能达到主系统至少80%以上的性能(磁 盘,CPU,网络,内存),这时建议使用 hyper-v 来虚拟windows,微软自身的产品,虚拟windows是绝对有优势的。
如果是虚拟 linux,建议:
本测试使用裸机作为虚拟服务测试的基准设备。在不跑虚拟机的情况下,两台裸机的性能偏差不会大于0.51%
在几乎所有测试中,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 处理方面很强悍,就需要更多测试。
在经过综合测试后,不论是单个parallel还是两个parallel,xen的跑分测试都比kvm要好。
三种虚拟化性能比较 LXC>>KVM>>XEN (由于LXC使用cgroup机制,其性能损坏基本为0。)
三种虚拟化隔离比较 XEN>>KVM>>LXC (LXC只能虚拟化linux)
三种虚拟化内存利用率 LXC>>KVM>>XEN (由于LXC共用内核,内存利用率最高;其他两种方案每个虚机都需要单独的操作系统占用一部分内存空间。)
从运算性能和磁盘负载角度来说Linux KVM不失为最快的虚拟化解决方案。相比之下,VirtualBox在测试中排名第二,而Xen在HVM模式下的虚拟化表现最差。
综上:比较有意思的是这些测试报告的结论都不太一样甚至是相反的。
如果以上产品我们不打算买厂商支持,其中vmware和hyper-v,是不建议使用的,主要是授权问题。
这时就剩下kvm和xen了,如果虚拟windows,建议使用 kvm,我们可以从 redhat那里免费拿到针对 windows 优化过的磁盘和网络的驱动 程序,可以达到较高的性能(几乎与hyper-v性能持平)。
而xen的 windows 优化驱动不是那么容易就能拿到的(由于redhat以后不支持 xen了,看看novell是否放水了,呵呵,就开放程度上来讲,redhat要好于novell)。
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 checkpointing and 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 |