Public wireless networks are often congested and located in a noisy RF environment. Standard TCP congestion control algorithms work inefficiently in these conditions, leading to frequent timeouts, large RTTs and poor overall performance. There are some tricks, however, which can be enabled to improve it a lot.
First, there is one simple option which can be changed to get an impressive performance increase. It is the network interface retry limit. By default, it is set to a relatively high value of 7:
Somehow, in a lossy environment this value results in a constantly overflowing packet queue, skyrocketing latency and, at some point, a disconnect. After setting it to 0 (
iwconfig wlan0 retry limit 0), packet queue will tend to overflow for a much lesser amount of time, and while latency will still probably be high and unstable, it will not grow infinitely anymore.
Per my experience, this change has resulted in latency drop from 10-160s (yes, seconds) to 0-12s (3-5s average), which is indeed a lot, but is manageable.
Linux TCP stack may be configured via
sysctl utility. The TCP options are listed in
man 7 tcp, and they are located in
net.ipv4 namespace. (Well, technically there is one for IPv6, too, but I haven’t seen a single IPv6-enabled public network, ever). So, the option
tcp_foo may be set to
1 by invoking
Interestingly, changing the TCP congestion control algorithms did not yield any visible result. On the other hand, changing several other options did.
There are three options worth mentioning. First two are related to F-RTO, a recovery algorithm designed specially for wireless networks.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
tcp_frto option is set to 2 by default on Debian, which is the recommended setting, but changing it to 1 sometimes improves the performance.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
This option is set to 0 by default, as the manpage suggests, but changing it to 2 makes retransmission delays much smaller.
1 2 3 4 5 6
Again, this option is disabled by default, and it seems that after enabling it, TCP stack prefers to retransmit more often.
You could make this settings to be applied on boot by adding them to
1 2 3 4