Optimal kernel configuration and patches for KVM host

To begin with, the "canonical" reference for KVM hypervisor tuning is still IBM's excellent Best Practices for KVM which I suggest you go through point-by-point.

Some things you will almost certainly want to do, after carefully testing with your intended workload:

  • Use virtio drivers in your Windows guests. You should already be doing this; if you aren't, this will give you a very noticeable speedup. Linux guests should automatically use virtio from installation, though if you are virtualizing very old Linux systems, double check them.

  • Dump BFS. It was designed for low-latency desktop loads on low-end hardware and its author admits that it will "not scale to massive hardware". Doesn't inspire confidence.

  • Dump BFQ/CFQ. Virtually everyone gets the highest performance with the deadline I/O scheduler, and while you should test, you likely won't be an exception.

  • Make sure kernel samepage merging is running, and tune it appropriately. This can significantly reduce memory requirements on your hypervisor, especially when multiple guests run the same OS.

  • When using local storage, use raw block devices, such as LVM logical volumes, rather than image files. This removes a layer of abstraction from disk I/O.

There are many other things covered in IBM's guide I referred to earlier, but these should give you the most bang for your buck.


In my experience, distributions like RHEL are well enough calibrated to provide good performance of KVM machines, and all benchmarks are done on those. If you want to squeeze out extra performance percents, you need to look highr in the stack - at virtio-scsi and data-plane (for disk performance) or 802.1Qbg/h for extra network performance.