Re: bhyve VM not getting as much upload bandwidth as the host

From: Miroslav Lachman <000.fbsd_at_quip.cz>
Date: Mon, 14 Aug 2023 21:35:07 UTC
On 14/08/2023 11:38, Patrick M. Hausen wrote:

[..]

>> I never had this solved. Even my FreeBSD guest on FreeBSD host with VirtualBox is slow as few hunderds kB/s
>> It was like 10Mbps with Bhyve. I only use VMs for testing but installing packages is always so slow. So you are not alone. I would really like to know how to improve the network speed with virtualized environment.
> 
> This looks weird to me. I run lots of VMs in production on TrueNAS CORE
> - essentially FreeBSD 13-STABLE with bhyve and all of them get near gigabit
> speed with bridged networking.
> 
> Guests:
> 
> Windows
> Ubuntu
> FreeBSD (OPNsense)
> 
> Specifically the OPNsense VM can route 700-800 Mbit/s across gigabit interfaces.
> 
> All my VMs use VirtIO network drivers - do yours?


NICs are emulated Intel PRO/1000 MT but I tested VirtIO in the past and 
it was the same.
Now I tried to disable RXCSUM and TXCSUM on host interface and it fixed 
it. It is strange to me because I never had speed problem on the host it 
self so I do not suspect anything wrong on host's interface.

1) speedtest in VM with RXCSUM & TXCSUM enabled
Hosted by Rohwerder Datasystems GmbH (Schwarzenbek) [463.71 km]: 42.018 ms
Testing download speed
Download: 7.37 Mbit/s
Testing upload speed
Upload: 25.16 Mbit/s

2) speedtest in VM right after I disabled RXCSUM & TXCSUM on the host
Hosted by Rohwerder Datasystems GmbH (Schwarzenbek) [463.71 km]: 23.841 ms
Testing download speed
Download: 242.99 Mbit/s
Testing upload speed
Upload: 24.80 Mbit/s

250 Mbit/s is a full speed of my home internet connection.

I don't know why but RXCSUM and TXCSUM cause more problems in my 
experiences. I remember I must disabled RXCSUM & TXCSUM in completely 
virtual environment of some cloud provider (based on KVM & Qemu) where 
we run about 10 machines and one of them should act like an Ipsec 
gateway fore a couple of private VMs. Packets were not forwarded between 
2 NICs until i disabled RX & TX csums on private VirtIO NIC - all VMs 
were FreeBSD 12.3 at that time.

Thank you!

Best regards
Miroslav Lachman