Debugging Slow Wifi
I ran into the ever common problem of slow WiFi recently. In this post I want to detail the experiments I ran and what I gleaned from the results.
Setting the Stage
First I'll describe the setup I have for my home wifi network and the problems I was experiencing.
- No problem streaming Netflix
- Trouble loading web pages occasionally
I had a weird set of problems in that I typically could stream episodes of shows on Netflix without any huge problems, but sometimes loading sites would be unbearably slow. It was common enough to be a huge pain, but the times when it worked well confused me. Why was it only sometimes slow?
- Modem: Arris Surfboard SB6141
- Router/AP: Google OnHub by TP-Link
I wanted to check if my internet was actually slow or whether I was just impatient. I ran speedtests from several different providers, and it was in fact slow. (billed speed was 100 Mb/s, observed was between 3-8 Mb/s).
At first, I was convinced that Comcast was to blame for my slow wifi speed.
However, I ruled this out by checking the internet speed over ethernet. Comcast was delivering speeds to my router that were much higher than I was observing at my laptop. (observed ethernet speeds between 56-75 Mb/s)
Next, I wanted to establish a baseline for what the point to point speed on my network was. This came out around 5 Mb/s which was really slow!
Next, I thought maybe there was a lot of WiFi congestion in my area. Maybe my router was picking a congested channel, or there was some kind of crazy interference in my apartment. To test this, I ran my raspberry pi right next to my router in AP mode. I was very surprised when the Raspberry Pi was able to get 33 Mb/s running on the same channel as my router.
- Fast.com: 8 Mbps
- speedtest.net: 4.6 Mbps
- speedof.me: 3.15 Mbps
Raspberry Pi on Ethernet
I plugged my Raspberry Pi into the ethernet port of my router. I then downloaded speedtest-cli (a CLI for running speed tests against speedtest.net). I also ran a test with
- speedtest-cli: 75 Mb/s
- wget: 6.9 MB/s => 56 Mb/s
Laptop to Laptop communication
iperf on 2 laptops. Laptop 1 is running Linux on a 2011 Macbook Air and was running
iperf -s (the server). Laptop 2 is a 2017 Macbook Pro running
iperf -c. I started out running with the default parameters which runs a test for 10 seconds, then switched to longer times using
iperf -c -t 60 to run the test for 60 seconds.
- Average for 10s (6 trials): 17.7 Mb/s
- Average for 60s (3 trials): 5 Mb/s
Raspberry Pi as AP
I put my raspberry pi in AP mode and had my laptop connect to it directly.
iperf -c -t 60: 33.4 Mb/s
My conclusion is that my router is not performing. I tried power cycling it to see if that would help, but the measurements were the same after. I am not certain why this is the case, especially since it is supposed to have 13 antennae which I would expect to lead to high LAN bandwidth. My next experiment is to order some UniFi hardware and see if was that improves the situation.
I never got a good answer as to why I was able to stream Netflix but regular websites would have trouble loading.
Hopefully my new hardware does the trick. I plan on writing a follow up post when I have it all set up to see if it makes a difference.
The exact command I ran:
wget --output-document=/dev/null http://speedtest.wdc01.softlayer.com/downloads/test500.zipNB:
wgetreports speeds in megaBYTES not megaBITS (like most wifi tools). Multiply by 8 to get a comparable number. ↩︎
To setup a Raspberry Pi as an AP, I used
udhcpdwhich you can find instructions for on raspberrypi.org ↩︎
I am going with a USG and a UniFi AP AC Lite. I went with Ubiquiti based on recommendations from some coworkers and a blog post by Troy Hunt that describes similar frustrations as mine. I debated whether to get an EdgeMax router over the USG after seeing some discussion in Troy's gist. I ended up going with the USG since I don't believe I'll benefit from the more advanced configuration opions of the EdgeMax, and I like the idea of all of it working with the UniFi portal. ↩︎