New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The network performance is somehow disastrous. #8
Comments
Hi @OrvilleQ I am currently not at home which has 80 MB/s (rx) and 30 MB/s (tx), a big difference if we compare the ADSL link where I am. Excerpt from net/speedtest-go: # speedtest-go
...
✓ Latency: 42.665045ms Jitter: 117.528µs Min: 42.406088ms Max: 42.883802ms
✓ Download: 4.51Mbps (used: 5.38MB) (latency: 61ms jitter: 37ms min: 48ms max: 205ms)
✓ Upload: 0.76Mbps (used: 0.91MB) (latency: 73ms jitter: 21ms min: 47ms max: 139ms) But if we compare the result of speedtest-go executed in a jail: # appjail jail list -j speedtest-go
STATUS NAME TYPE VERSION PORTS NETWORK_IP4
UP speedtest-go thin 13.2-RELEASE - 10.0.0.5
# appjail cmd jexec speedtest-go speedtest-go
...
✓ Latency: 31.867667ms Jitter: 845.172µs Min: 31.07015ms Max: 33.496017ms
✓ Download: 4.87Mbps (used: 5.80MB) (latency: 87ms jitter: 111ms min: 35ms max: 451ms)
✓ Upload: 0.76Mbps (used: 0.91MB) (latency: 91ms jitter: 63ms min: 51ms max: 250ms) It's even better, but this doesn't mean that the performance in jails is better, it's probably just better because # appjail network list
NAME NETWORK CIDR BROADCAST GATEWAY MINADDR MAXADDR ADDRESSES DESCRIPTION MTU
ajnet 10.0.0.0 10 10.63.255.255 10.0.0.1 10.0.0.1 10.63.255.254 4194302 AppJail network 576
# ifconfig jext | grep mtu
jext: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 576
# grep MTU /usr/local/etc/appjail/appjail.conf
DEFAULT_VIRTUALNET_MTU=576
# appjail version
3.2.0+15f7db9c07e005d852119b2346b93b9900d4e023 Another recommendation is to try to minimize configuration overhead:
# cat /etc/pf.conf
nat-anchor 'appjail-nat/jail/*'
nat-anchor "appjail-nat/network/*"
rdr-anchor "appjail-rdr/*" This is what AppJail requires to work when using Virtual Networks, no more, no less.
Bridges and Virtual Networks use if_bridge(4) and if_epair(4) drivers, and most jail frameworks and users use the same drivers for jail networking, so if you notice a performance overhead, this will affect to many people unless it is just a problem in your system.
I hope the above can help you, tell me any results you find. |
@DtxdF Thank you for your detailed instructions. I'll log the things I did down below in case I miss something.
The pf.conf file is as minimal as possible already.
Test the network speed using speedtest-go inside and outside the jail. The upload performance inside the jail is 40% slower compared to outside the jail, but it is still fast enough. Inside the jail:
Outide the jail:
The inner connection inside ajnet seems to be good, get a reasonable result using iperf3.
After compiling the Kernel to GENERIC with BBR enabled, nothing changed. I'll try disabling BBR next. |
After BBR disabled still nothing changed. Edit: I was using |
On a fresh Arm64 FreeBSD environment update to the latest patch (14.0-RELEASE-p6) with only appjail installed, using ZFS, EXT_IF and ON_IF set to vtnet0. pf configured. set up a test jail with
|
Thanks for telling me about the driver you use, vtnet, this helped me dig deeper into your problem, at least to investigate further on Bugzilla: The above is the most interesting, as it seems to be related to your problem, but look at the full search list:
Yes, this appears to be what was reported in the issue, since you are testing on the local system, packets don't travel outside of your interface.
This is a quote from the bug, comment 0. As speedtest-go informs you, Download seems to be affected, while Upload is only affected a bit. Of course, see the full bug, as the developer says some things that are relevant to investigate further. You haven't done anything wrong, this seems to be a bug between vtnet and the NAT implementation or something related. Of course this is not an AppJail issue, but I suggest the following:
|
You are right. After read all the comments and found a post back in 2016 described similar issue, I set inside the jail:
outside the jail:
But that means CPU now has to do all the checksum job and It could easily use around 50% CPU resource with maximum speed. Not a perfect solution but enough for now. I'll keep my eye on the bug fix in the future. Once again, thank you sincerely for the help. I've create a pull request to warn this issue in document. DtxdF/AppJail.docs#2 |
Thanks for the workaround and for the PR on the other repo! I'll merge it as soon as possible. I'll keep this in mind when writing the |
Just created a server on my Hetzner server located at Germany. I self built the kernel to enable bbr and it's now on 14.0-RELEASE-p6.
I followed your document and set pf, virtual networks and dns up, then I create a jail with
appjail quick packager virtualnet=":packager"
(nat is enabled on the virtualnet), but when I download ports using gitup I notice extremely slow network speed.Here's the result if I fetch a 10gb test file outside of jail:
And here's the result inside the jail:
It's 1500x times slower.
I'm new to FreeBSD, so I'm not sure where to start with debugging and digging useful information. If there are some specific details required, please inform me, and I will provide them as promptly as possible.
The text was updated successfully, but these errors were encountered: