High latency with VirtIO NIC
Hi,
I deployed KVM on my Gentoo servers for performance testing, but I am now having high latency problems with the VirtIO NIC:
diggle7 is the KVM host, diggle6 is another physical host in the same physical network, and app211 is a KVM guest running on diggle7.
------------------------------- ping statistics ------------------------------- diggle7 ~ # ping -c 5 app211
PING app211 (192.168.1.211) 56(84) bytes of data.
64 bytes from app211 (192.168.1.211): icmp_seq=1 ttl=64 time=0.454 ms 64 bytes from app211 (192.168.1.211): icmp_seq=2 ttl=64 time=0.097 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3 ttl=64 time=0.248 ms 64 bytes from app211 (192.168.1.211): icmp_seq=4 ttl=64 time=0.355 ms 64 bytes from app211 (192.168.1.211): icmp_seq=5 ttl=64 time=0.494 ms
--- app211 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3998ms rtt min/avg/max/mdev = 0.097/0.329/0.494/0.145 ms
diggle7 ~ # ping -c 5 diggle6
PING diggle6 (192.168.1.44) 56(84) bytes of data.
64 bytes from diggle6 (192.168.1.44): icmp_seq=1 ttl=64 time=0.101 ms 64 bytes from diggle6 (192.168.1.44): icmp_seq=2 ttl=64 time=0.076 ms 64 bytes from diggle6 (192.168.1.44): icmp_seq=3 ttl=64 time=0.085 ms 64 bytes from diggle6 (192.168.1.44): icmp_seq=4 ttl=64 time=0.130 ms 64 bytes from diggle6 (192.168.1.44): icmp_seq=5 ttl=64 time=0.083 ms
--- diggle6 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 3998ms
rtt min/avg/max/mdev = 0.076/0.095/0.130/0.019 ms ------------------------------- ping statistics -------------------------------
as above, the latency between Host and KVM guest(0.3+ms on average) is much higher than the latency between the two physical hosts(~0.1ms on average), this might not be acceptable for latency sensitive applications, for example memcached.
is the latency normal? or is there something wrong with my configuration? here is detailed information about my hardware and software environment:
Host hardware: DELL R710 + Intel Xeon E5620 @2.40GHz + 96GB memory + BCM5709 GB Ethernet Host software: Gentoo amd64 + 2.6.36-gentoo-r5 + qemu-kvm-0.13.0
KVM related kernel configs for the host (diggle7):
diggle7 ~ # zgrep -E "(VIRTIO|KVM)" /proc/config.gz CONFIG_VIRTIO_BLK=mCONFIG_VIRTIO_NET=m
# CONFIG_VIRTIO_CONSOLE is not set CONFIG_HW_RANDOM_VIRTIO=mCONFIG_HAVE_KVM=yCONFIG_HAVE_KVM_IRQCHIP=y CONFIG_HAVE_KVM_EVENTFD=y CONFIG_KVM_APIC_ARCHITECTURE=y CONFIG_KVM_MMIO=yCONFIG_KVM=mCONFIG_KVM_INTEL=m
# CONFIG_KVM_AMD is not setCONFIG_VIRTIO=mCONFIG_VIRTIO_RING=mCONFIG_VIRTIO_PCI=mCONFIG_VIRTIO_BALLOON=m
Kernel modules loaded on the host:
diggle7 ~ # lsmod
Module Size Used byvirtio_balloon 4098 0
tun 12809 2
bridge 63340 0
stp 1871 1 bridge
llc 4595 2 bridge,stp
drbd 181114 7lru_cache 6273 1 drbdvirtio_net 10812 0
virtio 3978 2 virtio_balloon,virtio_netvirtio_ring 4692 2 virtio_balloon,virtio_netxt_state 1218 1iptable_filter 1626 1iptable_nat 3806 0nf_nat 15835 1 iptable_natnf_conntrack_ipv4 11106 4 iptable_nat,nf_natnf_defrag_ipv4 1361 1 nf_conntrack_ipv4iptable_mangle 1591 0ipmi_devintf 7380 0ipmi_si 37990 0ipmi_msghandler 31256 2 ipmi_devintf,ipmi_sikvm_intel 42059 18
kvm 248729 1 kvm_intel
fuse 58921 2
KVM related kernel configs for the guest (app211):
app211 ~ # zgrep -E "(VIRTIO|KVM)" /proc/config.gz CONFIG_KVM_CLOCK=yCONFIG_KVM_GUEST=yCONFIG_VIRTIO_BLK=yCONFIG_VIRTIO_NET=y CONFIG_VIRTIO_CONSOLE=y CONFIG_HW_RANDOM_VIRTIO=y CONFIG_HAVE_KVM=y
# CONFIG_KVM is not setCONFIG_VIRTIO=yCONFIG_VIRTIO_RING=yCONFIG_VIRTIO_PCI=y CONFIG_VIRTIO_BALLOON=y
Command line for starting the KVM guest:
diggle7 ~ # pgrep -fl qemu
18154 /usr/bin/qemu-system-x86_64 --enable-kvm -drive file=/vm/app211/app211.qcow2,if=virtio,boot=on,cache=writeback -cdrom /mfs/sysadmin/finnix.iso -boot c -vnc diggle7:211 -net nic,model=virtio,macaddr=52:54:C0:A8:01:D3 -net tap,ifname=app211,script=no -m 30720 -cpu host -smp 16 -daemonize
any help will be appreciated.
Thanks,
Xupeng
Quoted 5 lines · Xupeng Yun
Hi,
I deployed KVM on my Gentoo servers for performance testing, but I am now having high latency problems with the VirtIO NIC:
Try vhost-net, that should have much better latencies.
Signature · 1 line
error compiling committee.c: too many arguments to function
On Thursday, March 24, 2011 at 6:22 PM, Avi Kivity wrote:
Try vhost-net, that should have much better latencies.
Quoted 1 line
Indeed, the latency is much better after switching to vhost-net, it drops from 3+ms to ~1.5ms on average
when there is no network load on the KVM guest, but the latencies become bad again when there is heavy network load on the guest(~70Mbps RX and ~25Mbps TX).
--------------------------- ping KVM guest (app211) from the host --------------------------- 64 bytes from app211 (192.168.1.211): icmp_seq=3582 ttl=64 time=3.08 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3583 ttl=64 time=1.10 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3584 ttl=64 time=1.03 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3585 ttl=64 time=3.55 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3586 ttl=64 time=1.29 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3587 ttl=64 time=0.710 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3588 ttl=64 time=64.4 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3589 ttl=64 time=0.271 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3590 ttl=64 time=0.563 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3591 ttl=64 time=1.66 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3592 ttl=64 time=0.939 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3593 ttl=64 time=0.819 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3594 ttl=64 time=16.5 ms
--------------------------- ping KVM guest (app211) from the host ---------------------------
any idea?
Thanks,
Xupeng
Quoted 2 lines · Xupeng Yun
Indeed, the latency is much better after switching to vhost-net, it drops from 3+ms to ~1.5ms on average
Typo, should be "it drops from 0.3+ms to ~0.15ms on average"
--
I like Linux & Python
http://blog.xupeng.me
Quoted 21 lines · Xupeng Yun
On Thursday, March 24, 2011 at 6:22 PM, Avi Kivity wrote:
Try vhost-net, that should have much better latencies.Quoted 1 line
Indeed, the latency is much better after switching to vhost-net, it drops from 3+ms to ~1.5ms on average
when there is no network load on the KVM guest, but the latencies become bad again when there is heavy network load on the guest(~70Mbps RX and ~25Mbps TX).
--------------------------- ping KVM guest (app211) from the host --------------------------- 64 bytes from app211 (192.168.1.211): icmp_seq=3582 ttl=64 time=3.08 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3583 ttl=64 time=1.10 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3584 ttl=64 time=1.03 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3585 ttl=64 time=3.55 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3586 ttl=64 time=1.29 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3587 ttl=64 time=0.710 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3588 ttl=64 time=64.4 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3589 ttl=64 time=0.271 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3590 ttl=64 time=0.563 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3591 ttl=64 time=1.66 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3592 ttl=64 time=0.939 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3593 ttl=64 time=0.819 ms
64 bytes from app211 (192.168.1.211): icmp_seq=3594 ttl=64 time=16.5 ms
Quoted 4 lines
--------------------------- ping KVM guest (app211) from the host ---------------------------
any idea?
Isn't it normal? With heavy load, packets start to queue.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 14 lines · Avi Kivity
Quoted 14 lines
64 bytes from app211 (192.168.1.211): icmp_seq=3582 ttl=64 time=3.08 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3583 ttl=64 time=1.10 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3584 ttl=64 time=1.03 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3585 ttl=64 time=3.55 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3586 ttl=64 time=1.29 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3587 ttl=64 time=0.710 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3588 ttl=64 time=64.4 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3589 ttl=64 time=0.271 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3590 ttl=64 time=0.563 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3591 ttl=64 time=1.66 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3592 ttl=64 time=0.939 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3593 ttl=64 time=0.819 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3594 ttl=64 time=16.5 ms
Quoted 7 lines
Quoted 5 lines
--------------------------- ping KVM guest (app211) from the host
---------------------------any idea?
Isn't it normal? With heavy load, packets start to queue.
Thank you, if the performance drop (from 0.15ms to 1-64ms) at this workload is normal, I am okay with it.
Signature · 2 lines
I like Linux & Python http://blog.xupeng.me
Quoted 18 lines · Xupeng Yun
Quoted 17 lines · Avi Kivity
Quoted 17 lines
64 bytes from app211 (192.168.1.211): icmp_seq=3582 ttl=64 time=3.08 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3583 ttl=64 time=1.10 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3584 ttl=64 time=1.03 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3585 ttl=64 time=3.55 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3586 ttl=64 time=1.29 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3587 ttl=64 time=0.710 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3588 ttl=64 time=64.4 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3589 ttl=64 time=0.271 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3590 ttl=64 time=0.563 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3591 ttl=64 time=1.66 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3592 ttl=64 time=0.939 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3593 ttl=64 time=0.819 ms 64 bytes from app211 (192.168.1.211): icmp_seq=3594 ttl=64 time=16.5 ms
--------------------------- ping KVM guest (app211) from the host
---------------------------
Quoted 8 lines
Quoted 4 lines
Quoted 2 lines
any idea?
Isn't it normal? With heavy load, packets start to queue.
Thank you, if the performance drop (from 0.15ms to 1-64ms) at this workload is normal, I am okay with it.
I don't know if this is exactly the point at which latency should rise; what I'm saying is that it can't remain low at all load levels.
Signature · 1 line
error compiling committee.c: too many arguments to function
Quoted 2 lines · Avi Kivity
I don't know if this is exactly the point at which latency should rise; what I'm saying is that it can't remain low at all load levels.
Agree with you, it's reasonable. what puzzled me is that I don't know if there is something wrong with my configurations.