The speed of light vs. the internet

Translated from Polish. Originally published on morony.pl on 31 Aug 2016.

I remember the days when you had to dial up to get on the internet. Everything was painfully slow and you paid for your time "online". My first permanent connection had a bandwidth of 115200 kbps (kilobits per second). A strange number, but that was the limit of the serial connection between the modem and the computer. Content on the internet was of course tailored to such poor bandwidth, but we still looked enviously at people with a "T1" line, where speeds reached a few megabits. Those days are long gone; fewer and fewer people get their internet over copper or cable TV lines, and more and more over fiber. For the past six months I've been a happy owner of fiber internet too. This is what my "speedtest" looks like now:

Bandwidth itself matters when you download a lot of content: e.g. 4K video streaming or other large chunks of data. For everyday use another parameter matters – the time a small packet of data needs to get from the server to your computer. Every time you open a web page, thousands of such packets are exchanged with various servers, so it's important for that time to be as short as possible. In the image above you can see a measured ping of 2 ms – that's the time from my computer sending a packet to a server, which "bounces" it back, until it returns to my computer. 2 ms is very little: 1/500 of a second. I started wondering how ping time depends on the server's location. For its speed test, speedtest.net always picks one of the nearest servers, and there are thousands of them around the world. You can of course pick a few distant ones by hand, but who wants to do that sort of thing manually.

I downloaded the list of all servers from http://www.speedtest.net/speedtest-servers.php. I selected the ones that had geographic coordinates and started pinging. I pinged each one 10 times and took the best result. I assigned each tested server to a continent, plotted it on a map and calculated the straight-line distance from my computer to the server. This is where the first problem comes up – a data packet never takes the shortest route, only one where there are cables. What's more, there's never any guarantee it will take the same route every time – that's the magic of the internet.

I plotted the servers on a map:

And the results on a chart:

The speed of light in a vacuum is 299,792,458 m/s, which is roughly 300,000 km/s. In optical fiber the speed is lower, about 200,000 km/s. On the chart I drew curves corresponding to several speed values. You can see that the packet travels to North America at about 130,000 km/s and to the other continents at about 100,000 km/s. This is probably because on the way from Europe to the US there's an ocean, where the fiber simply lies straight along the seabed. In other directions the route is more complicated and there are many nodes on land. And that's exactly it. Along the way, the packet passes through many nodes where it gets routed onward – and all of that costs precious time!

I'm not publishing the code of my program here, because it isn't particularly pretty, and the problem itself is relatively simple. But if anyone is interested in the source code, let me know.