If you use QEMU-KVM (or virt-manager GUI) for running your virtual machines, you can specify a disk driver to be used for accessing the machine’s disk image. By default IDE is selected, but VirtIO is a very popular choice as well. How do they compare in performance?
I used Fedora 17 as a host, Fedora 18 as a guest system. I used bonnie++ for testing. I ran
$ bonnie++ -s 3g
twice for each driver. The disk images were in the form of raw files. The results are:
IDE round 1:
Version 1.96 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP localhost 3G 76 97 24645 25 15658 17 1229 97 277235 56 717.8 65 Latency 196ms 3233ms 804ms 10194us 7619us 90962us Version 1.96 ------Sequential Create------ --------Random Create-------- localhost -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 4738 72 +++++ +++ 7411 62 4893 74 +++++ +++ 7853 59 Latency 1019us 6430us 7828us 693us 174us 824us
IDE round 2:
Version 1.96 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP localhost 3G 68 87 24893 26 15971 17 1063 85 282355 56 730.7 66 Latency 260ms 679ms 734ms 43305us 8152us 85837us Version 1.96 ------Sequential Create------ --------Random Create-------- localhost -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 4740 72 +++++ +++ 7488 65 4833 73 +++++ +++ 7757 65 Latency 2480us 6227us 7094us 745us 251us 760us
VirtIO round 1:
Version 1.96 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP localhost 3G 77 98 56770 38 32139 19 1222 98 392441 49 937.4 53 Latency 167ms 512ms 666ms 9544us 7309us 85529us Version 1.96 ------Sequential Create------ --------Random Create-------- localhost -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 5303 81 +++++ +++ 8301 74 5398 81 +++++ +++ 8851 68 Latency 3725us 6628us 7241us 738us 970us 795us
VirtIO round 2:
Version 1.96 ------Sequential Output------ --Sequential Input- --Random- Concurrency 1 -Per Chr- --Block-- -Rewrite- -Per Chr- --Block-- --Seeks-- Machine Size K/sec %CP K/sec %CP K/sec %CP K/sec %CP K/sec %CP /sec %CP localhost 3G 77 97 57202 35 32640 19 1230 98 395489 48 972.4 50 Latency 241ms 1478ms 684ms 9326us 81461us 84019us Version 1.96 ------Sequential Create------ --------Random Create-------- localhost -Create-- --Read--- -Delete-- -Create-- --Read--- -Delete-- files /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP /sec %CP 16 4753 74 +++++ +++ 8434 71 5473 82 +++++ +++ 8987 69 Latency 8461us 5904us 7358us 706us 72us 779us
The results (see description) are pretty clear. VirtIO is substantially faster for disk I/O operations. If you don’t use it, you should definitely consider it. If you run a lot of installation tests or other heavy disk operations like I do, it can be a pretty significant difference in performance.
“By default IDE is used” – afaik virtio is used too, if you select appropriate os in the libvirt-manager. Like RHEL 6+ or Fedora 15+. Nice testing!
You’re right, if I create a new Linux machine, it uses virtio. But if I edit an existing Linux machine and choose Add new storage, IDE is the default. Bad, bad virt-manager!
not a surprise… but on some guest we have approximatively the same performance inside the VMs, but not using virtio cost a lot of cpu on the hypervisor.