How to speed up wifi on Librem laptops

After fighting horrible performance problems for several weeks, I learned the following:

  1. 2.4 GHz vs. 5 GHz wifi is anything but a trivial distinction. The former gets about 50% more range, whereas the latter tends to be much faster if you’re closer to the router. All else being equal, it’s nice to have a signal which decays faster in air, so that when wifi sniffers drive by your home, your SSID will be just that much less likely to be observed (although it can be picked up in other ways from leaky devices). Speaking of which, you might want to hide your SSID, although some wifi UIs seem unwilling to connect to such ghosts.

  2. The difference in realized throughput can be 2X or even 5X at times. If you’re far from the router, 5 GHz is going to have to be slow for physical reasons. If you’re on 2.4 GHz for the range but you have a busy radio environment (neighbors, drivebys, etc.), then the interference can cause slower transmission and higher error rates. Worse still, when you experience slow bandwidth, the CPU naturally gets bored and tries to get other work done while awaiting the next packet. But this causes cache line evictions which will lower performance when those lines are needed again later. So your bandwidth gets less and less and your CPU works harder and harder. The fan cranks up but nothing much gets done. The network stack can occasionally get bogged down to the point that timeouts start to happen and connections get dropped.

  3. If you like 2.4 GHz for whatever reason, you can get a bit stronger signal if you buy a USB wifi dongle. They’re cheap and have the added benefit of masking your onboard MAC address with another one which can be swapped out at will. Just be careful which wifi device you’re talking to when you attempt to connect to a network.

  4. You can sometimes widen the channel width on your router. (Each base frequency actually describes a neighborhood of several channels with slightly different frequencies. This is how multiple devices can share the same “frequency” without actually interfering.) In my experience, this did nothing for performance, but it might help you.

  5. Counterintuitively, a moderately busy CPU will tend to provide better network performance than an idle one. This goes back to the issue above. Provided that the workload isn’t evicting too many cache lines, but is rather just keeping the CPU at full frequency, then interrupts will be serviced more rapidly because the CPU won’t enter the idle state. So if you run a tight loop on one or more cores, which does nothing but increment a counter, then you might actually notice that network throughput increases on other cores, especially if they’re Hyperthreaded peers tied to the same clock source.

  6. If you’re running a VPN, your performance is going to be capped by your router’s ability to perform the required packet transformations. This can result in a severe throughput penalty.

  7. Failing all else, use your hardware radio switch to disconnect. Wait 5 seconds, then turn it on again. If that still doesn’t work, try the same with your router’s power button. In the latter case, you’ll probably end up with a new IP and perhaps a new peer at your ISP’s side, which occasionally does wonders for performance. I’ve seen this work in totally different network environments. Low tech but sometimes quite effective.

Related:

2 Likes

They’re cheap unless you prefer to have FLOSS firmware:
https://tehnoetic.com/tehnoetic-wireless-adapter-gnu-linux-libre-tet-n150

2 Likes