measure the response time of a link

Posted by Ahoura Ghotbi on Stack Overflow See other posts from Stack Overflow or by Ahoura Ghotbi
Published on 2012-10-20T22:24:55Z Indexed on 2012/10/20 23:01 UTC
Read the original article Hit count: 160

Filed under:
|

I am trying to create a simple load balance script and I was wondering if it is possible to find the response time of a server live? By that I mean is it possible to measure how long it takes for a server to respond after the request has been sent out?

What I am trying to do is fairly simple, I want to send a request to a link/server and do a count down, if the server took more than 5 seconds to reply, I would like to fall on the backup server.

Note that it doesnt have to be in pure php, I wouldnt mind using other languages such as javascript, C/C++, asp, but I prefer to do it in PHP. if it is possible to do the task, could you just point me to the right direction so I can read up on it.

Clarification

What I want to do is not to download a file and see how long it took, my servers have high load and it takes a while for them to respond when you click on a file to download, what I want to do is to measure the time it takes the server to respond (in this situation, its the time it takes the server to respond and allow the user to download the file), and if it takes longer than x seconds, it should fall back on a backup server.

© Stack Overflow or respective owner

Related posts about php

Related posts about linux