rethink-app icon indicating copy to clipboard operation
rethink-app copied to clipboard

Slow transfer speeds when RethinkDNS + Firewall is enabled

Open lucaspar opened this issue 2 years ago • 4 comments

I noticed a steep decrease in the transfer speeds on Syncthing when using the app. To make sure it wasn't a Syncthing issue, I ran iperf3 with the phone as the client and a desktop in the same network as the server.

Each run below lasts for approx. 10 seconds and it's similar to the transfer speeds I see in Syncthing.

# Rethink DNS + Firewall on:

[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.04  sec  9.46 MBytes  7.91 Mbits/sec                  receiver
[  5]   0.00-10.01  sec  15.4 MBytes  12.9 Mbits/sec                  receiver
[  5]   0.00-10.09  sec  13.1 MBytes  10.9 Mbits/sec                  receiver

# Rethink DNS + Firewall "stopped": 

[ ID] Interval           Transfer     Bitrate
[  5]   0.00-10.04  sec   301 MBytes   252 Mbits/sec                  receiver
[  5]   0.00-10.04  sec   351 MBytes   293 Mbits/sec                  receiver
[  5]   0.00-10.08  sec   401 MBytes   333 Mbits/sec                  receiver

We can see that when Rethink (DNS and Firewall) is enabled, the transfer speeds are less than 5% of the normal speeds. Is this the expected behavior or is there anything users can do to improve it?

lucaspar avatar Aug 05 '22 02:08 lucaspar

I'd presume the speed drop is a combination of Rethink's packet processing and Synching unable to P2P the connection over the local network (when rethink is enabled).

ignoramous avatar Aug 06 '22 01:08 ignoramous

Can you check with speed test, too? For ex, speed.cloudflare.com?

Btw, Rethink, I'd presume, would hit a cap at 150mbps (or, ~18.75 MBps).

ignoramous avatar Aug 07 '22 15:08 ignoramous

With a 100 Mbps connection (often maxing at 110-120 Mbps), I'm getting these numbers:

Measurement Speed
speed.cloudflare.com 30-34 Mbps
speedtest.net 50-70 Mbps
fast.com 60-70 Mbps

In all these websites I get the full connection speed when Rethink is disabled.

The LAN speeds above seem to be much slower for some reason.

lucaspar avatar Aug 07 '22 15:08 lucaspar

The slowness is expected. If you are okay with just DNS-based firewall, that shouldn't muck much with the underlying network bandwidth. If not, you can always exclude apps from the Rethink Firewall itself, and that app shouldn't see any slowdowns.

There's not much we can't do much without root access (for bandwidth). The effort for which is tracked here #78

ignoramous avatar Aug 14 '22 15:08 ignoramous

In v054, we moved network-engine in Rethink to gvisor/netstack which is multi-threaded (unlike the previous single-threaded impl based on LwIP), and that should have resulted in speed-ups. Although, using Rethink means apps could never saturate the available bandwidth, it shouldn't be terribly slow.

@lucaspar With Rethink (v054) enabled, I see my Android do 700mbps+ download (speed.cloudflare.com) on 5G. Can you please re-run the tests on your end and see if the speeds remain terrible or if they have improved? If former, please feel free to re-open this bug. Thanks (:

ignoramous avatar Aug 11 '23 08:08 ignoramous