Virtio网络性能参数调整
Futures
- vhost-net zero-copy
- virtqueue
- multi-queue
vhost-net zero-copy
In Red Hat Enterprise Linux 7, vhost-net zero-copy is disabled by default. To enable this action on a permanent basis, add a new file to /etc/modprobe.d/vhost-net.conf
with the following content:
options vhost_net experimental_zcopytx=1
To confirm that this has taken effect, check the output of cat /sys/module/vhost_net/parameters/experimental_zcopytx
. It should show:
$ cat /sys/module/vhost_net/parameters/experimental_zcopytx
0
Redhat Bridge Zero Copy Transmit
virtqueue
KVM默认情况下, 每个virtqueue队列深度缺省为256. 可以通过指定KVM相关参数(rx_queue_size
, tx_queue_size
)最高提升至1024.
Support for virtio-net rx/tx queue sizes
multi-queue
Multi-queue virtio-net provides an approach that scales the network performance as the number of vCPUs increases, by allowing them to transfer packets through more than one virtqueue pair at a time.
Today's high-end servers have more processors, and guests running on them often have an increasing number of vCPUs. In single queue virtio-net, the scale of the protocol stack in a guest is restricted, as the network performance does not scale as the number of vCPUs increases. Guests cannot transmit or retrieve packets in parallel, as virtio-net has only one TX and RX queue.
To use multi-queue virtio-net, enable support in the guest by adding the following to the guest XML configuration (where the value of N is from 1 to 256, as the kernel supports up to 256 queues for a multi-queue tap device):
<interface type='network'>
<source network='default'/>
<model type='virtio'/>
<driver name='vhost' queues='N'/>
</interface>