Marco's Blog

All content personal opinions or work.
en eo

Speedtesting Your ISP, Command Line Version

2015-01-13 4 min read Howto marco

I currently pay an obscene $66 for 25 MBit/sec Internet. On top of that, I had to pay a mandatory $99 equipment fee for an enormous modem, and another $99 fee for mandatory installation.

Just as I was done with my first year promotional price and things “reverted” to the “regular” price of $66, I received a message. I had been underbilled, apparently, but I was lucky and they were not going to backcharge me. But from now on, I had to pay the “regular” price of $74.50.

At the same time, performance of my Internet connection started getting really random. At times, things would load just fine. Most of the time, though, there were sudden hickups and slowdowns. For instance, I would get all tiles on a Google Maps page – but then the last five or ten or twenty wouldn’t load for minutes.

You may have heard of Speedtest.net. It’s been around forever, and it’s a fairly reliable indicator of Internet connection speed. It also collects information about Internet providers and gives you an idea of what everybody’s paying around you. It’s also getting a little heavy on the commercialization now, so I don’t know how long I would continue using it, since its utility is paired with the simplicity of the thing it does.

Its biggest drawback, though, is that it requires Flash. Maybe back in the day that was acceptable, but nowadays there is both no excuse for requiring Flash and a sufficient number of browsers that don’t support Flash by choice. So I looked for an alternative. And I found one in http://speedof.me/

On the surface, Speedof.me is both simpler and more informative than Speedtest.net. The latter tells you how it’s determining the nearest server and makes a big deal of pinging and figuring out latency. Speedof.me doesn’t, but it provides you with a request-by-request display of download speeds. It also gives you a graph of your speed history, both for downloads and uploads.

I really liked it. I don’t know how accurate it is, but it seemed to be right on target. Its results neatly lined up with Speedtest. Which was a complete catastrophe. In essence, both tools agreed that my Internet speed was “up to” 27 MBit/sec, but that in 5 out of 6 tests, I was actually getting closer to 3-4 MBit/sec.

Here another problem was revealed: I was testing in a browser, connected to the Internet thanks to a WiFi connection to a router that was attached to the modem. As any reasonable person, I first assumed the WiFi connection to be the issue. After all, I had lived in places where the neighbor coming home and turning on the WiFi turned into outages for me, until I found an unused channel.

But all my tests yielded the same result: the WiFi connection was stable and strong, close to its theoretical limit of 450 MBit/sec. So what gave? And, more importantly, how to test?

I looked for something that might help me test things systematically, and found a Python project called speedtest-cli. It was exactly what I wanted: something I could run in a timed fashion, consistently, throughout the day, and not just when I had angst.

The installation was dead simple. I simply typed:

sudo pip install speedtest-cli

You can get it in a bunch of ways, though, if you don’t like the Python installer (pip above). The basic idea is that once it’s there, you run speedtest-cli and get a result like this:

Retrieving speedtest.net configuration...
Retrieving speedtest.net server list...
Testing from AT&T U-verse (xxx.xxx.xxx.xxx)...
Selecting best server based on latency...
Hosted by AT&T (San Diego, CA) [11.79 km]: 36.862 ms
Testing download speed........................................
Download: 3.87 Mbits/s
Testing upload speed..................................................
Upload: 3.11 Mbits/s

(This was just the latest result, not an attempt to complain. Although a complaint would be justified.)

I have a machine hooked up directly to the router, bypassing all WiFi issues. It is there, straight at the source. If the router gets 25 MBit/sec, that machine gets it, too.

You have heard about that machine: it’s what generated the surf chart I presented here. I say, generated because among the other changes brought by the new year, in addition to a phony increase in price and a spotty connection, I also lost HTTPS and SSH access to my home from the outside. Go figure.

I let speedtest-cli run every ten minutes – a reasonable compromise between too much load on the service and enough data to prove my point. Here is the result, generated using the ever-powerful matplotlib:

speed