Using VirtIO NIC

From KVM

Using virtio_net For The Guest NIC

The following is done using Debian Lenny, with the 2.6.25 kernel installed from Sid.

  • install the guest OS as per normal, using rtl8139 or e1000 for the guest NIC
  • boot into the guest as per normal
  • edit /etc/apt/sources.list to add a sid repo
  • install the 2.6.25 kernel
  • boot into the guest using the 2.6.25 kernel
  • edit /etc/initramfs-tools/modules and add virtio, virtio_pci, virtio_ring, virtio_net, virtio_blk
  • update the initramfs using update-initramfs -u
  • shutdown the guest
  • change the -net nic option to include model=virtio
  • boot the guest

Throughput Tests Using iperf

To see what the throughput differences would be like, I ran a bunch of iperf tests from a Debian guest.

Host Server Config

  • Tyan h2000M motherboard
  • 2x dual-core Opteron 2220 CPUs @ 2.8 GHz
  • 8 GB DDR2-667 ECC SDRAM (2x 2 GB sticks per CPU)
  • 3Ware 9650SE-16ML SATA-II RAID Controller
  • 12x 500 GB SATA-II harddrives in a single RAID-6 array
  • Intel PRO/1000-MT PCIe quad-port gigabit NIC (configured as 4-port bond0, used as the kvm bridge)
  • Debian Lenny installed, updated June 04, 2008, with kvm-69 and kernel 2.6.25 (kernel from Sid)

Guest VM Config

  • 1 CPU
  • 2 GB RAM
  • 100 GB virtual harddrive (via LVM)
  • Debian Lenny with kernel 2.6.25 from Sid
  • /usr/bin/kvm -name mail -daemonize -localtime -usb -usbdevice tablet -smp 1 -m 1048 -vnc :04 -pidfile /var/run/kvm/mail.pid -net nic,macaddr=00:16:3e:00:00:04,model=virtio -net tap,ifname=tap04 -boot c -drive index=0,media=disk,if=virtio,boot=on,file=/dev/mapper/vol0-mail

iperf Server Config

  • iperf -s -w 65536 -p 12345 -I 5

iperf Client Configs

  • [1] iperf -c <server> -w 65536 -p 12345 -t 60
  • [2] iperf -c <server> -w 65536 -p 12345 -t 60 -d
  • [3] iperf -c <server> -w 65536 -p 12345 -t 60 -P 4

Results

These are averaged over 3 runs.

To the host (virtio)

  • [1] 92 Mbps

To a server connected to a gigabit port on the same switch (virtio)

  • [1] 834 Mbps
  • [2] 519 Mbps out, 531 Mbps in
  • [3] 906 Mbps combined

To a server connected to a gigabit port on the same switch (e1000)

  • [1] 296 Mbps
  • [2] 259 Mbps out, 62 Mbps in
  • [3] 302 Mbps combined