Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Measure a visitor's connection speed? 3

Status
Not open for further replies.

awaresoft

Programmer
Feb 16, 2002
373
DE
Anyone have any suggestions on how I might measure a visitors connection speed to our site?

I'm looking for an estimate only. DSL reports offers some reports that test connection speed using a Java applet and by uploading/downloading some large files.

I don't need something as accurate (or as complicated or as time consuming) as what DSL reports offers.

Any ideas on how to get started? Anyone doing anything similar?

Malcolm
 
Ingresman,

Thanks for the link to BrowserHawk. This product certainly captures a lot of information, but I did not find their connection speed measurement to be accurate.

BrowserHawk estimated my connection speed at 93K. DSL Reports (dslreports.com) estimated my connection speed at 2.8M. I tested on a 3M cable connection.

Perhaps BrowserHawk needs a longer connection to accurately measure connection speed? (dslreports.com's estimate takes longer to run)

Malcolm

 
Ingresman,

I'm going to keep looking. BrowserHawk is aimed at that the Microsoft Windows/IIS world and I'm looking for a solution that works well in the LunarPages hosting environment.

Thanks for following up on this,

Malcolm
 
Write it yourself then... it's pretty easy, but do be aware that it's a) prone to error and b) bandwidth costly to your server depending on accuracy.

The way I wrote it (sorry I think I threw out the code)...
Have several files on your server varying in size... that way the guy testing a 28.8k connection doesn't die waiting for a 3 meg download.

Use javascript to time how long it takes to download a file, sorry I don't remember the specifics on how this works but I'm sure someone in the javascript forum does, or you can probably find it on google... it's basically start timer, fetch file, stop timer... then use javascript to fill out a form and submit the information back to your PHP server... and have the information include the file name so you can verify the size.

Now you can do whatever you want with the info... obviouslly, if the info is just for the users sake there's no need to submit it back to the PHP server.

Also... make sure to take necessary steps to avoid caching or everyone gets a really fat connection on reload all of a sudden.

 
Skiflyer,

Your strategy makes sense. It's on my todo list :)

Thanks for your help,

Malcolm
 
You can stream the file contents and use microtime to measure how long time it takes.

that way, it's client independent.

Olav Alexander Mjelde
Admin & Webmaster
 
Olav and SKiflyer,

Great ideas - thanks for your help! Any suggestions for a decent sized file to use for measurement balancing dialup users and users with fast broadband connections?

I'm thinking (pulling this one out of a hat) of using a 100K binary file intentionally chosen so that it doesn't compress well (factoring out server side gzip encryption if in place)

What do you think?

Malcolm
 
If you look here:

There is an example there, where it opens the file in binary.
I however think you need to specify that the browser is not to cache the image, in case they run the test twice.

ps. I stumbled across this:

I think that is great? Opensource, needs developers, etc.

Olav Alexander Mjelde
Admin & Webmaster
 
Ps. I already found one weakness:
* You can manipulate the querystring to fake the results.

If you plan to use it, modify it to use $_POST[''] or maybe session variable?

Also, I did not look at how it handles multiple tests per user. Maybe you would want to store all tests each user made, show max, avg and min they got for results?

The limits are endless...
eg. you can make this test visible only for registerred users, so then you can have some "top 5", "avg" and "bottom 5" bandwidth-users..

I think this could be interesting to some communities.

Olav Alexander Mjelde
Admin & Webmaster
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top