Sunday, January 31, 2016

How does the Speed test app work - Legacy HTTP

There are mainly three tests to be performed 

1. Latency 
2. Download Test
3. Upload Test 

Latency Test is performed by measuring the time it takes to get a response for a HTTP request sent to a web server. This test is repeated multiple times with the lowest value determining the final result. 

Download Test is performed by downloading small binary files to estimate the connection speed. Based on this result, one of several file sizes is selected to use the real download test. This test is performed with cache prevention via random string appended to each download. Throughput samples are received at upto 30 times per second. These samples are then aggregated to 20 slices (each being 5% of the samples). The remaining slices are averaged together to get the final result. 

Upload test is performed by sending small amount of random data generated in the client and sent to the web server to estimate the connection speed. Based on the result, an appropriately sized chunk of randomly generated data is selected for upload. The upload test is then performed in chunks of uniform size, pushed to the server side script via POST. normally it creates 4 HTTPS threads as well to saturate the connection. Chunks are sorted by speed and the fastest half is averaged to eliminate anomalies and determine the result. 

Deciding the number of threads 

Typically, for e.g. Speedtest app uses unto 4 HTTP threads. However, it will use only more than 2 threads only if it is required to measure the speed accurately. This is done to minimize the HTTP overhead in lowest connection speeds. After the pre-test, if the connection is at least 4Mbps, then it will use 4 threads. However, there is a catch. On old browsers, only two connections per domain might be supported, in this case, the sub domain might be required for the 3rd and 4th connection. 

References

No comments:

Post a Comment