Skip to contentSkip to conversation

Poor network performance with cable modem assigned to guest

DISCUSSION Jon Fairbairn 3 participants 5 messages Aug 28, 2009 – Sep 12, 2009 KVM

lore
Share & tools
lore
#0 lore raw

I'm experimenting with a virtual router. I did this a few years ago with Xen and it worked well enough, but then fedora changed and it stopped working, so I gave up for a while. Now I have a machine that supports hardware virtualisation, I thought I'd try again.

The setup was done through virt-manager. The network between the host and guest is a virtual bridge. What I've been trying to do is to assign a USB cable modem to the guest, and connect to the internet through that. I'd expect some degradation in performance, especially since there's a firewall on both the virtual router and on the host. Here's some figures wgetting a 12802500 byte file thrice from a nearby web server:

Via hardware router: 1009K/s 1008K/s 1010K/s (12 or 13s)
Cable modem on host: 1.00M/s 1.00M/s 1.00M/s (ditto)

(wait for it)

Via virtual router, assigned usb: 21.1K/s (9m 58s!)

Now, as I said, I expected some performance hit doing it this way, but a factor of fifty takes the biscuit.

What can be wrong?

* * *

Details:

"Cable modem on host" above just means that I attached the cable modem to the host and configured it as a network device in the usual way.

From the host to the guest I get about 12MB/s using scp, from the guest to the host (initiated from the host) I get 7MB/s.

The host is AMD Athlon(tm) 64 X2 Dual Core Processor 4400+ with 6G of RAM of which 256M is assigned to the guest (the hardware version only has 188M) neither virtual nor hardware router has any swap.

The hardware router is the same kernel and nearly (modulo IP addresses etc) the same configuration as the virtual router, running on an old ibm pc (500MHz pentium III).

kernel on host: 2.6.29.6-217.2.16.fc11.x86_64
kernel on routers: 2.6.29.6-217.2.8.fc11.i586

All running fedora 11 (though the routers are very much cut down installations).

qemu-kvm-0.10.6
libvirt-0.6.2-15.1.fc11.x86_64

libvirt uses this command to start the virtual machine:

LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin /usr/bin/qemu-kvm -S -M pc \
-m 256 -smp 1 -name monogramme-virtual \
-uuid [redacted] -monitor pty \
-pidfile /var/run/libvirt/qemu//monogramme-virtual.pid \
-boot d \
-drive file=/[wherever]/livecd-fedora-monogramme.iso,\
if=ide,media=cdrom,index=2 \
-net nic,macaddr=54:52:00:14:4f:18,vlan=0 \
-net tap,fd=11,vlan=0 -serial pty -parallel none -usb -vnc 127.0.0.1:0 \
-k en-gb \
-usbdevice host:0bb2:6098

0bb2:6098 = Ambit Microsystems Corp. USB Cable Modem (a usb 1.1 device)

Selinux is on on both machines.

I can't think of anything else relevant at the moment.

Signature · 1 line
Jón Fairbairn                                 [email protected]
#1 lore raw
Quoted 8 lines · Jon Fairbairn

I'm experimenting with a virtual router. I did this a few years ago with Xen and it worked well enough, but then fedora changed and it stopped working, so I gave up for a while. Now I have a machine that supports hardware virtualisation, I thought I'd try again.

The setup was done through virt-manager. The network between the host and guest is a virtual bridge. What I've been trying to do is to assign a USB cable modem to the guest,

This is probably your problem here. KVM only emulates a usb1.1 controller, and from all reports, it doesn't really do that very well. There have been numerous reports of poor performance even for a usb1.1 device. You should check the archives to see if there was ever any kind of tips or resolution to some of those problems.

Quoted 64 lines

and connect to the internet through
that. I'd expect some degradation in performance, especially since there's a firewall on both the virtual router and on the host. Here's some figures wgetting a 12802500 byte file thrice from a nearby web server:

Via hardware router: 1009K/s 1008K/s 1010K/s (12 or 13s)
Cable modem on host: 1.00M/s 1.00M/s 1.00M/s (ditto)

(wait for it)

Via virtual router, assigned usb: 21.1K/s (9m 58s!)

Now, as I said, I expected some performance hit doing it this way, but a factor of fifty takes the biscuit.

What can be wrong?

* * *

Details:

"Cable modem on host" above just means that I attached the cable modem to the host and configured it as a network device in the usual way.

From the host to the guest I get about 12MB/s using scp, from the guest to the host (initiated from the host) I get 7MB/s.

The host is AMD Athlon(tm) 64 X2 Dual Core Processor 4400+ with 6G of RAM of which 256M is assigned to the guest (the hardware version only has 188M) neither virtual nor hardware router has any swap.

The hardware router is the same kernel and nearly (modulo IP addresses etc) the same configuration as the virtual router, running on an old ibm pc (500MHz pentium III).

kernel on host: 2.6.29.6-217.2.16.fc11.x86_64
kernel on routers: 2.6.29.6-217.2.8.fc11.i586

All running fedora 11 (though the routers are very much cut down installations).

qemu-kvm-0.10.6
libvirt-0.6.2-15.1.fc11.x86_64

libvirt uses this command to start the virtual machine:

LC_ALL=C PATH=/sbin:/usr/sbin:/bin:/usr/bin /usr/bin/qemu-kvm -S -M pc \
-m 256 -smp 1 -name monogramme-virtual \
-uuid [redacted] -monitor pty \
-pidfile /var/run/libvirt/qemu//monogramme-virtual.pid \
-boot d \
-drive file=/[wherever]/livecd-fedora-monogramme.iso,\
if=ide,media=cdrom,index=2 \
-net nic,macaddr=54:52:00:14:4f:18,vlan=0 \
-net tap,fd=11,vlan=0 -serial pty -parallel none -usb -vnc 127.0.0.1:0 \
-k en-gb \
-usbdevice host:0bb2:6098

0bb2:6098 = Ambit Microsystems Corp. USB Cable Modem (a usb 1.1 device)

Selinux is on on both machines.

I can't think of anything else relevant at the moment.

#2 lore raw
Quoted 6 lines · Brian Jackson
Quoted 5 lines · Jon Fairbairn

I'm experimenting with a virtual router. I did this a few years ago with Xen and it worked well enough, but then fedora changed and it stopped working, so I gave up for a while. Now I have a machine that supports hardware virtualisation, I thought I'd try again.

Quoted 7 lines
Quoted 3 lines

The setup was done through virt-manager. The network between the host and guest is a virtual bridge. What I've been trying to do is to assign a USB cable modem to the guest,

This is probably your problem here. KVM only emulates a usb1.1 controller,

that shouldn't be a problem as the cable modem is only a usb 1.1 device.

Quoted 1 line

and from all reports, it doesn't really do that very well.

Not very well? We're talking about a factor of *FIFTY* slow down here. If I'd implemented the driver in a 1980s lazy functional language I would have only expected a factor of ten :-P ;-).

Quoted 3 lines

There have been numerous reports of poor performance even for a usb1.1 device. You should check the archives to see if there was ever any kind of tips or resolution to some of those problems.

I had a look, but I couldn't find anything helpful. Maybe I'm searching for the wrong things?

Signature · 1 line
Jón Fairbairn                                 [email protected]
#3 lore raw
Quoted 24 lines · Jon Fairbairn
Quoted 6 lines · Brian Jackson
Quoted 5 lines · Jon Fairbairn

I'm experimenting with a virtual router. I did this a few years ago with Xen and it worked well enough, but then fedora changed and it stopped working, so I gave up for a while. Now I have a machine that supports hardware virtualisation, I thought I'd try again.

Quoted 7 lines
Quoted 3 lines

The setup was done through virt-manager. The network between the host and guest is a virtual bridge. What I've been trying to do is to assign a USB cable modem to the guest,

This is probably your problem here. KVM only emulates a usb1.1 controller,

that shouldn't be a problem as the cable modem is only a usb 1.1 device.

Quoted 1 line

and from all reports, it doesn't really do that very well.

Not very well? We're talking about a factor of *FIFTY* slow down here. If I'd implemented the driver in a 1980s lazy functional language I would have only expected a factor of ten :-P ;-).

Quoted 6 lines
Quoted 3 lines

There have been numerous reports of poor performance even for a usb1.1 device. You should check the archives to see if there was ever any kind of tips or resolution to some of those problems.

I had a look, but I couldn't find anything helpful. Maybe I'm searching for the wrong things?

I don't have any specific answers, but you might be able to get some more info by uncomenting the "//#define DEBUG" in kvm's usb-linux.c. You might also try capturing the USB traffic (e.g. with wireshark) both in the host with the modem connected directly, and in the guest with the modem passed through, to see if there are any differences other than speed (packet sizes, etc). Also try comparing the "lsusb -vvv" output in both guest and host?

-jim

#4 lore raw
Quoted 16 lines · Jim Paris
Quoted 15 lines · Jon Fairbairn
Quoted 8 lines · Brian Jackson
Quoted 3 lines · Jon Fairbairn

The setup was done through virt-manager. The network between the host and guest is a virtual bridge. What I've been trying to do is to assign a USB cable modem to the guest,

This is probably your problem here. KVM only emulates a usb1.1 controller,

that shouldn't be a problem as the cable modem is only a usb 1.1 device.

Quoted 1 line

and from all reports, it doesn't really do that very well.

Quoted 7 lines
Quoted 3 lines

Not very well? We're talking about a factor of *FIFTY* slow down here. If I'd implemented the driver in a 1980s lazy functional language I would have only expected a factor of ten :-P ;-).

I don't have any specific answers, but you might be able to get some more info by uncomenting the "//#define DEBUG" in kvm's usb-linux.c. You might also try capturing the USB traffic (e.g. with wireshark)

Thanks for your comments; I was waiting for a time when the network wasn't in constant use to try some experiminents, but unfortunately my ISP has replaced the cable modem with a newer version that doesn't have a USB port, so I have to abandon this approach anyway.

[Assigning a physical PCI device to a kvm guest doesn't work with AMD Athlon(tm) 64 X2 Dual Core Processor 4400+
does it?]

Signature · 1 line
Jón Fairbairn                                 [email protected]