From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: ping latency using vhost_net, macvtap and virtio Date: Tue, 04 Sep 2012 15:51:17 +0300 Message-ID: <5045F945.9060605@redhat.com> References: <503DD42B.7050808@uhulinux.hu> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-2 Content-Transfer-Encoding: QUOTED-PRINTABLE Cc: kvm@vger.kernel.org To: =?ISO-8859-2?Q?Pozs=E1r_Bal=E1zs?= Return-path: Received: from mx1.redhat.com ([209.132.183.28]:60264 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1757057Ab2IDMvX (ORCPT ); Tue, 4 Sep 2012 08:51:23 -0400 In-Reply-To: <503DD42B.7050808@uhulinux.hu> Sender: kvm-owner@vger.kernel.org List-ID: On 08/29/2012 11:34 AM, Pozs=E1r Bal=E1zs wrote: >=20 > Hi all, >=20 > I have been testing network throughput and latency and I was wonderin= g > if my measurements are as expected. > For the test, I used Fedora 17 for both host and guest, using kernel > 3.5.2-3.fc17.86_64. >=20 > Pinging an external server on the LAN from the host, using a gigabit > interface, the results are: > # ping -c 10 172.16.1.1 > PING 172.16.1.1 (172.16.1.1) 56(84) bytes of data. > 64 bytes from 172.16.1.1: icmp_req=3D1 ttl=3D64 time=3D0.109 ms > 64 bytes from 172.16.1.1: icmp_req=3D2 ttl=3D64 time=3D0.131 ms > 64 bytes from 172.16.1.1: icmp_req=3D3 ttl=3D64 time=3D0.145 ms > 64 bytes from 172.16.1.1: icmp_req=3D4 ttl=3D64 time=3D0.116 ms > 64 bytes from 172.16.1.1: icmp_req=3D5 ttl=3D64 time=3D0.110 ms > 64 bytes from 172.16.1.1: icmp_req=3D6 ttl=3D64 time=3D0.114 ms > 64 bytes from 172.16.1.1: icmp_req=3D7 ttl=3D64 time=3D0.112 ms > 64 bytes from 172.16.1.1: icmp_req=3D8 ttl=3D64 time=3D0.117 ms > 64 bytes from 172.16.1.1: icmp_req=3D9 ttl=3D64 time=3D0.119 ms > 64 bytes from 172.16.1.1: icmp_req=3D10 ttl=3D64 time=3D0.128 ms >=20 > --- 172.16.1.1 ping statistics --- > 10 packets transmitted, 10 received, 0% packet loss, time 8999ms > rtt min/avg/max/mdev =3D 0.109/0.120/0.145/0.011 ms >=20 >=20 > Pinging the same external host on the LAN from the guest, the latency > seems to be much higher: > # ping -c 10 172.16.1.1 > PING 172.16.1.1 (172.16.1.1) 56(84) bytes of data. > 64 bytes from 172.16.1.1: icmp_req=3D1 ttl=3D64 time=3D0.206 ms > 64 bytes from 172.16.1.1: icmp_req=3D2 ttl=3D64 time=3D0.352 ms > 64 bytes from 172.16.1.1: icmp_req=3D3 ttl=3D64 time=3D0.518 ms > 64 bytes from 172.16.1.1: icmp_req=3D4 ttl=3D64 time=3D0.351 ms > 64 bytes from 172.16.1.1: icmp_req=3D5 ttl=3D64 time=3D0.543 ms > 64 bytes from 172.16.1.1: icmp_req=3D6 ttl=3D64 time=3D0.387 ms > 64 bytes from 172.16.1.1: icmp_req=3D7 ttl=3D64 time=3D0.348 ms > 64 bytes from 172.16.1.1: icmp_req=3D8 ttl=3D64 time=3D0.364 ms > 64 bytes from 172.16.1.1: icmp_req=3D9 ttl=3D64 time=3D0.345 ms > 64 bytes from 172.16.1.1: icmp_req=3D10 ttl=3D64 time=3D0.334 ms >=20 > --- 172.16.1.1 ping statistics --- > 10 packets transmitted, 10 received, 0% packet loss, time 8999ms > rtt min/avg/max/mdev =3D 0.206/0.374/0.543/0.093 ms >=20 >=20 > The LAN, the host and guest are idle otherwise during the tests. > There are no iptables rules active. > The vhost_net and macvtap modules are loaded on the host, and qemu wa= s > started (by libvirtd) with the -netdev vhost=3Don option. > The guest is using the virtio_net driver. >=20 > Is this expected and normal, or do others see better latencies? Can I > try anything to make it better? We've seen this, at least in once case the problem is due to the extra threads needed for virtualization; each one of them sits on a core, and if that core is in deep C state it will take quite a while to wake up. You can verify this by booting the host with idle=3Dpoll on the kernel command line, or simply running some load in the background. --=20 error compiling committee.c: too many arguments to function