Origin Clouds
← All posts
QEMU/KVM17 November 2026 · 8 min read

Five QEMU/KVM settings we change on almost every engagement

By Origin Clouds Engineering, Platform team

qemu/kvm

QEMU will boot almost anything with almost no flags, which is exactly why its defaults are conservative. On most tuning engagements the biggest wins come from the same handful of settings. Measure before and after each one; your workload decides which matter.

1. Expose the host CPU

A generic CPU model hides instructions your guest could use. If all your hosts are identical, -cpu host (host-passthrough in libvirt) gives the guest everything. If you live-migrate across mixed hardware, pick a named model that every host supports instead, or migrations will fail.

2. Use virtio for disks and NICs

Emulated IDE disks and e1000 NICs exist for guests without drivers. Modern Linux has virtio drivers built in, and Windows needs the virtio-win drivers installed once. Add vhost=on to virtio-net so packet processing happens in the kernel rather than in QEMU's main loop.

3. Pick a sensible disk cache and AIO mode

cache=none bypasses the host page cache, so memory isn't double-cached and the guest's flushes reach storage. Pair it with aio=native or aio=io_uring. Raw images are fastest; qcow2 buys you snapshots and thin provisioning at some cost.

bash
qemu-system-x86_64 \
  -machine q35,accel=kvm -cpu host -smp 4 -m 8G \
  -drive file=disk.raw,format=raw,if=none,id=d0,cache=none,aio=io_uring \
  -device virtio-blk-pci,drive=d0 \
  -netdev tap,id=n0,ifname=tap0,script=no,downscript=no,vhost=on \
  -device virtio-net-pci,netdev=n0 \
  -nographic

4. Back large guests with hugepages

Memory-heavy guests such as databases spend real time on TLB misses with 4 KiB pages. Reserve hugepages on the host and back guest RAM with them.

bash
-object memory-backend-file,id=mem,size=8G,mem-path=/dev/hugepages,share=on \
-machine q35,accel=kvm,memory-backend=mem

5. Pin vCPUs and respect NUMA

On multi-socket hosts, a guest whose vCPUs and memory sit on different NUMA nodes pays for every remote access. In libvirt, use vcpupin and numatune so a latency-sensitive guest stays on one node, and keep a core or two free for the host and QEMU's I/O threads.

Every one of these trades flexibility for speed. Write down which hosts and guests get which profile, or you'll end up debugging a migration failure at 2 a.m.

Running this in production?

We help teams design, harden and tune platforms like this one.

Talk to an engineer