HTTP Ping – roundtrip times using redirect
December 3rd, 2009 | by Sean |I’ve been moving some of the stuff I wrote on poditronic.com over to spider.my recently. I can tell the Spinneret API is starting to settle down, because there’s less pain every time I update my existing applications to match the new API. It also shows up some lingering bugs too!
The latest thing added to spider.my is a completely new page that offers an ‘HTTP Ping‘. ‘Ping’ on the Internet usually describes a utility that tells you how long it takes for data to go from your computer to another computer and back again. Ping is a very accurate measurement of the time between two pieces of hardware on the Internet, because almost no processing is performed at all at either end – not in the creation of the tiny packet of data, nor in its echo.
The ping test is not an entirely accurate test of a user’s “Internet experience”, since we tend to send and receive much larger pieces of information, and – unlike ping, which is a utility that operates at very low levels – we tend to use web browsers and interact with web servers. With that in mind, I’ve made a page for spider.my that will repeatedly (for small numbers of repeats) test the time it takes for a browser to request a page, receive and ‘understand’ a response, and send another response.
An HTTP Redirect is a response from a webserver to your browser that tells your browser the page it is looking for has a different URL to the one you typed in (or clicked on another site). There are lots of goods uses for HTTP redirect, but you only really need to know that lots of sites use them, and you usually know nothing about it. Your browser requests one URL, the web browser says “that page has moved to X” and your browser loads the new URL instead. Spider.my uses a redirect when you browse the ‘root’ URL – http://spider/my/ – to redirect your browser to a page with a name – http://spider.my/homepage.html – because I think pages with proper names are a good idea!
The redirect round-trip timer at spider.my allows you to select a number of redirects, and start the timing process. Your browser will send a request to spider.my, which will send a ‘redirect’ reply. Actually, the redirect is to the same page, but with an argument that counts the number of remaining requests before a page with the results are shown. It’s that simple. Most browsers will allow more than ten redirects, but ten is the highest number of redirects the page at spider.my will send.
Spider.my is hosted in the USA, so timings should be greater the further away you are from the USA. If there’s a very large difference from one timing to the next, your Internet connection may be suffering from packet loss. The ping utility only tries once (unless it’s magic, as pings on TM’s network seem to have been for some months) – if a ping packet goes missing it is reported as missing and another one is tried. HTTP connections are made over a reliable transport, so the redirects are guaranteed to arrive. If something bad happens to an HTTP transfer, parts may be re-sent after a time-out elapses.
While I was writing the page, my Streamyx connection was abysmal. Web pages were taking sometimes minutes to load, and typing commands over an SSH session was unbearable. With delays between typing a key and seeing the character appear of anything up to 20 seconds, a typo was heartbreaking! Streamyx has been much better today, but there were still some poor timings in the afternoon.
What use is this page?
Good question! At the moment, you can only get timings between your PC and spider.my’s server in the USA. If you suspect your Internet connection has ‘issues’ you can use the page at different times of day to see if delays are different at different times of day, or you can use it to compare with a friend. You might also get some idea of the relative performance of different Internet Service Providers in your country.
On my local network, the redirect round-trip takes a very small time, and which browser I use seems to make a much greater difference! Perhaps I’ll write that one up for a blog article one day.