Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am setting up diagnostic servers on local networks (Redhat 5.5). One requirement is a speed test where users in the network can test the speed of their internet connection (e.g., ).

I have been given the impression that their are open source solutions that I can use. I'm not sure yet if it makes a difference, but sometimes users might be accessing the speed test through a web page and sometimes the users will get the data from a Java application I am building.

share|improve this question

migrated from Nov 3 '11 at 15:19

This question came from our site for professional and enthusiast programmers.

up vote 2 down vote accepted

A few years back I just home-rolled a very simple one with a static html file, javascript, and a couple of jpegs. It only does the download speed check (not the ping or upload speed check). The interesting parts of the web page are as follows:

The javascript portion:

<script language="JavaScript" type="text/javascript"><!--

start = 0;
initDone = false;

testImageSize = 680314;
testImageName = 'test_image.jpg';

flippedTestImageSize = 680441;
flippedTestImageName = 'flipped_test_image.jpg';

fileSize = testImageSize;
fileName = testImageName;

document.testimage.src = fileName + '?t=' + start; 

function startTest () {
  start = (new Date()).getTime();
  if (fileName == testImageName) {
    fileSize = flippedTestImageSize;
    fileName = flippedTestImageName;
  else {
    fileSize = testImageSize;
    fileName = testImageName;
  document.testimage.src = fileName + '?t=' + start; 

function finishTest () {
  end = (new Date()).getTime();

  secondsTaken = (end - start) / 1000;

  connectSpeed = (Math.floor((((fileSize * 8) / secondsTaken) / (1024 * 1024)) * 10) / 10);

  if (initDone) {
      downloadTime.value    = secondsTaken;
      imageFileSize.value   = fileSize;
      connectionSpeed.value = connectSpeed;
  else {
    initDone = true;


The form:

<form name="testForm">
  <table style="padding: 5px;">

      <td><input type="button" name="dotest" value="Do Test" onClick="startTest()"></td>

      <td class="lbl">Image download time (s):</td>
      <td class="inp"><input type="text" name="downloadTime" readonly="true"></td>


      <td class="lbl">Image size (bytes):</td>
      <td class="inp"><input type="text" name="imageFileSize" readonly="true"></td>

      <td class="lbl">Estimated speed (Mbps):</td>
      <td class="inp"><input type="text" name="connectionSpeed" readonly="true"></td>


And finally, somewhere in the page is:

<img name="testimage" src='test_image.jpg' width="400" alt="" onLoad="finishTest()">

While I have neither the need or interest in making it fancier, I wouldn't think it would be too hard make a page that had some additional bells/buzzers on it...

share|improve this answer
Thanks, I gave a thumbs up. I have played with the code a little and I like. I am splitting hairs a little, but I think it should be used with a large file size; the way I understand TCP is there is 2 'hello' ACKs and 1 request ACK before a file is finally transfered. That's three trips before data starts moving on the fourth ACK. I think a large file size might make this negligable though. Am I wrong in my understanding (anyone)? How would just the file transfer time be measured? I still need to measure upload time as well. – John R Nov 3 '11 at 22:53
Glad it's useful. For our purposes we are mostly interested in variations from "typical" (as opposed to the actual numbers) as a way of flagging performance changes/problems on the LAN vs. problems with a users desktop. I would think a larger filesize would provide a more accurate measure. I don't see how you could split out the handshaking vs. file transfer times in the browser as that's happening at a lower level in the networking stack. – gsiems Nov 4 '11 at 2:56

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.