As with all benchmarking one has to be really careful in interpreting the results and there are indeed many objections one can have with the current setup. One of them is for instance that I considered running only one VM at a time. Another is that I did not measure the load on the host while testing a VM. Also, the tests are done on a laptop. Results could vary on different hardware. Nevertheless, the purpose of this benchmarking was just to get some feeling for the effects of various tuning parameters.
The conclusions that I am drawing from this are:
- The differences between the performance with various IO schedulers on host and guest are not that significant. There is however a slight tendency for deadline on the host and noop on the guest to be the best combination. This seems to be inline with what some manufacturers also recommend, see for instance here
- The difference in network performance between paravirtualized drivers (virtio) and emulated drivers is negligible on a 100Mbps network. Also the performance of the guests is practically identical to that of the host.
- Hugepages on the host can result in a small speedup of a guest.
- Additional caching by the host probably helps the performance of the guests.
- Use of para-virtualized drivers for disk IO does help performance a lot compared to emulated drivers, in particular when it comes to write performance. Nevertheless, unixbench and bonnie++ seem to contradict each other when it comes to comparing disk performance of the host with that of the guest.
Based on these benchmarking results I am going to use the following settings for KVM:
- Use para-virtualized disk IO drivers. This is the most essential optimization to make.
- Use hugepages on the host to be used by the guests.
- Use deadline scheduler on the host.
- Use noop scheduler on the guest.
- Use para-virtualized network drivers: Even though it does not have a performance advantage in the benchmarks it should be more efficient, so I am including this for ‘theoretical’ reasons.
Use of paravirtualized drivers can give problems with maiden install and upgrades because it requires special drivers. Fortunately, it is easy to just start up a given VM using emulated drivers that was previously started using paravirtulized drivers. In fact this is what I did for these tests. In any case, the choices for these tuning parameters can easily be changed later, either in the VM configuration on the host or with a simple change inside the guest.
Finally, a great thanks to the KVM community for making such an excellent virtualization solution. In all these tests it held up fine and worked without a glitch. After this, I am completely convinced that I will use KVM on the new server.