Question

Assuming a Linux host with KVM running a Linux guest VM with virtio interfaces, what is the limiting factor on the throughput that can be achieved for the virtio interface ?

Even though the bandwidth might be 1 Gbps since its a virtual interface I am assuming the data throughput can be more. Is the throughput bound by the CPU of the guest VM or there will be a virtio driver limitation before that ?

Was it helpful?

Solution

The virtio driver is a paravirtualized driver which means the some of the innards of the driver, the ring buffers and registers are exposed to the guest and can be accessed by the guest as if it is writing to guest memory with less of a hit.

The size of the ring buffers exposed is then one limit, and is hard coded to 256 elements. I have seen some qemu patches to increase that size, but it's not in the mainline so I'm guessing the disadvantage of extra memory use was too high to allow this in.

The better approach is to have your guest OS utilize multiple virtio queues. Default is one for tx and one for rx. So you have multiple tx queues and then load balance traffic over that for example. This would give higher throughput but not for a single session.

vhost-net is perhaps a better way to go. I've not tried this myself, but as I understand it, this is the same virtio interface exposed to the guest, but the backend is implemented as a kernel module and not in the user space qemu; which allows for lower interrupt latency I'd imagine. Oh yes, interrupt latency is another limiting factor and its best I've found for the guest driver to pull as many packets off of the ring as possible per interrupt to maximize speed. vhost-net details are here http://www.linux-kvm.com/content/how-maximize-virtio-net-performance-vhost-net

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top