All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: "Fischer, Anna" <anna.fischer@hp.com>
Cc: Arnd Bergmann <arnd@arndb.de>,
	Mark McLoughlin <markmc@redhat.com>,
	"kvm@vger.kernel.org" <kvm@vger.kernel.org>
Subject: Re: Network throughput limits for local VM <-> VM communication
Date: Wed, 17 Jun 2009 10:50:19 +0300	[thread overview]
Message-ID: <4A38A03B.20904@redhat.com> (raw)
In-Reply-To: <0199E0D51A61344794750DC57738F58E67D2DCF44F@GVW1118EXC.americas.hpqcorp.net>

On 06/17/2009 10:36 AM, Fischer, Anna wrote:
>
> /usr/bin/qemu-system-x86_64 -m 1024 -smp 2 -name FC10-2 -uuid b811b278-fae2-a3cc-d51d-8f5b078b2477 -boot c -drive file=,if=ide,media=cdrom,index=2 -drive file=/var/lib/libvirt/images/FC10-2.img,if=virtio,index=0,boot=on -net nic,macaddr=54:52:00:11:ae:79,model=e1000 -net tap net nic,macaddr=54:52:00:11:ae:78,model=e1000 -net tap  -serial pty -parallel none -usb -vnc 127.0.0.1:2 -k en-gb -soundhw es1370
>
>    

Okay, like I suspected, qemu has a trap here and you walked into it.  
The -net option plugs the device you specify into a virtual hub.  The 
command line you provided plugs the two virtual NICs and the two tap 
devices into one virtual hub, so any packet received from any of the 
four clients will be propagated to the other three.

To get this to work right, specify the vlan= parameter which says which 
virtual hub a component is plugged into.  Note this has nothing to do 
with 802.blah vlans.

So your command line should look like

    qemu ... -net nic,...,vlan=0 -net tap,...,vlan=0 -net nic,...,vlan=1 
-net tap,...,vlan=1

This will give you two virtual hubs, each bridging a virtual nic to a 
tap device.


> This is my "routing VM" that has two network interfaces and routes packets between two subnets. It has one interface plugged into bridge virbr0 and the other interface is plugged into virbr1:
>
> brctl show
> bridge name     bridge id               STP enabled     interfaces
> virbr0          8000.8ac1d18c63ec       no              vnet0
>                                                          vnet1
> virbr1          8000.2ebfcbb9ed70       no              vnet2
>                                                          vnet3
>    

Please redo the tests with qemu vlans but without 802.blah vlans, so we 
see what happens without packet duplication.

> If I use the e1000 virtual NIC model, I see performance drop significantly compared to using virtio_net. However, with virtio_net I have the network stalling after a few seconds of high-throughput traffic (as I mentioned in my previous post). Just to reiterate my scenario: I run three guests on the same physical machine, one guest is my routing VM that is routing IP network traffic between the other two guests.
>
> I am also wondering about the fact that I do not seem to get CPU utilization maxed out in this case while throughput does not go any higher. I do not understand what is stopping KVM from using more CPU for guest I/O processing? There is nothing else running on my machine. I have analyzed the amount of CPU that each KVM thread is using, and I can see that the thread that is running the VCPU of the routing VM which is processing interrupts of the e1000 virtual network card is using the highest amount of CPU. Is there any way that I can optimize my network set-up? Maybe some specific configuration of the e1000 driver within the guest? Are there any known issues with this?
>    

There are known issues with lack of flow control while sending packets 
out of a guest.  If the guest runs tcp that tends to correct for it, but 
if you run a lower level protocol that doesn't have its own flow 
control, the guest may spend a lot of cpu generating packets that are 
eventually dropped.  We are working on fixing this.

> I also see very difference CPU utilization and network throughput figures when pinning threads to CPU cores using taskset. At one point I managed to double the throughput, but I could not reproduce that setup for some reason. What are the major issues that I would need to pay attention to when pinning threads to cores in order to optimize my specific set-up so that I can achieve better network I/O performance?
>    

It's black magic, unfortunately.  But please retry with the fixed 
configuration and we'll continue from there.

-- 
Do not meddle in the internals of kernels, for they are subtle and quick to panic.


  reply	other threads:[~2009-06-17  7:50 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-09 11:06 Network throughput limits for local VM <-> VM communication Fischer, Anna
2009-06-09 13:39 ` Mark McLoughlin
2009-06-09 13:55   ` Fischer, Anna
2009-06-10 13:29     ` Arnd Bergmann
2009-06-10 13:57       ` Fischer, Anna
2009-06-11  7:49         ` Arnd Bergmann
2009-06-11  8:01           ` Fischer, Anna
2009-06-11  8:17             ` Avi Kivity
2009-06-11  8:46               ` Fischer, Anna
2009-06-11  8:50                 ` Avi Kivity
2009-06-17  7:36                   ` Fischer, Anna
2009-06-17  7:50                     ` Avi Kivity [this message]
2009-06-17  8:12                       ` Fischer, Anna
2009-06-17 12:22                         ` Avi Kivity
2009-06-17 15:41                           ` Fischer, Anna
2009-06-18  8:37                             ` Avi Kivity

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4A38A03B.20904@redhat.com \
    --to=avi@redhat.com \
    --cc=anna.fischer@hp.com \
    --cc=arnd@arndb.de \
    --cc=kvm@vger.kernel.org \
    --cc=markmc@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.