Low throughput over LAN on Wi-Fi
Table of Contents
2021-11-23
I've updated the latest state at the end, the "fix" is not needed anymore.
2021-03-05
I wrote about the fix: Improving Samba's performance on OpenBSD.
Increasing
net.inet.divert.sendspace
in/etc/sysctl.conf
fixes it.
I've been streaming media from my computer over LAN & it's been slow. I finally tested it today & the average speed was around 300 KB/s. This is when sending data from computer to phone over SSH while both are connected to router via Wi-Fi.
Both devices were on 2.4 GHz band & close to the router. When I connect the computer with Ethernet cable it averages around 10 MB/s. And when I connect the computer on 5 GHz to router it averages around 1 MB/s. 1 MB/s is fine for my work so I'll just leave it like this.
2020-10-24
Things work at > 2 MB/s on average. I tested this with a 100 MB file.
andinus@ ~> dd if=/dev/urandom of=/home/andinus/test.file bs=1m count=100 100+0 records in 100+0 records out 104857600 bytes transferred in 3.801 secs (27581619 bytes/sec) andinus@ ~> rsync /home/andinus/test.file phone:/storage/emulated/0/ sending incremental file list test.file 104,857,600 100% 2.31MB/s 0:00:43 (xfr#1, to-chk=0/1) sent 104,883,302 bytes received 35 bytes 2,356,928.92 bytes/sec total size is 104,857,600 speedup is 1.00
This changed after OpenBSD 6.8 update.
Also, this issue was only on LAN because the Internet throughput was higher than 300 KB/s which meant I could transfer files faster by transferring it over the Internet.
This reminds me of the story someone told me long ago on some IRC channel. Back when the Internet used to be slow, at times it was faster to browse through Tor. Because Tor nodes were run by Universities which large connections. I don't recall it completely so I might be forgetting something. Maybe it was something like this:
User ------------------------------------------------------ Destination | | ----- University ===== fast connection ============ -> = fast connection -> - slow connection
I still don't understand though because if the limiting factor is user's connection then it shouldn't help, same for limiting factor being the destination's connection. But here we are assuming there is no packet loss, maybe back then the loss was significant which means that this setup would actually be faster than direct connection:
User -------------------------------------------------------------------- Destination | | ----- University ===== fast connection ============ University 2 = -> = fast connection -> - slow connection
Here "University 2" is close to the Destination which means less packet loss for it, assuming loss increases proportional to distance. This might get the file faster through Tor.
2021-11-03
I've noticed significant improvement after 7.0 update. Haven't tried
samba
yet but rsync
works at ~4MB/s. The difference (from 6.9) is
noticeable.
2021-11-23
rsync
goes upto 6MB/s
now.