One thing you can count on this list, if I say something incorrect, it will get corrected, so stay tuned.
I had made some assumptions that perhaps I shouldn't have. I assumed that your remote server was a typical machine running apache, php, mysql, and lots of other stuff. I don't believe pings are answered by the apache server daemon, which I think is what you are trying to measure. I believe pings are responded to at a very primitive level within the tcp/ip software, for example you may get a successful ping on a server, but the apache web server could be shut down. I think pings even use a different tcp/ip port number. Suppose you did this; Create a simple page on the remote server that echoes a short page, small enough to fit in a single packet if possible. Something like; <?php echo "Hello"; ?> You write an application to run on your local machine, perhaps also using php; <?php For($x=0; $x<10000; $x++) { $s = microtime(); $fp = fopen("remoteurl","r"); $page = fread($fp,10000); $f = microtime(); .... At this point you will need to process the microtime to determine elapsed time $accum += $elapsed; } ... At this point $x contains number of hits and $accum will give you total time ... You can get the average time from this In this example you've minimized the amount of execution time and transfer time for the page by making it small, so most of elapsed time will be the response time you are looking for. By using a php script at the remote end, you are measuring the load times, if any for PHP and your Script. If the time clocks were exactly in sync on both servers, you could have the remote page echo the microtime on that server, and you could compare the two, but since they are probably very different, that will not work. Somehow I think coming close is the best you are going to be able to do. Good luck, Warren Vail -----Original Message----- From: Tobias Grønlund [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 04, 2004 5:38 PM To: [EMAIL PROTECTED] Subject: Re: [PHP] Re: webserver response-time, how? okey, i had a hunch that my sollution was to easy to be the right one... How about timing a ping sent to the server (e.g. like pinging a person on irc), could that be possible, or is there flaws in that plan to??? Warren Vail wrote: > I could be wrong, but I don't think it measures all the time you want. > > The fsockopen will measure the time it takes to resolve the dns entry, > and open the socket, but it does not measure the time it takes to get > the request to the server (you could send the request thru your socket > and if you are doing blocked transfers, the question becomes, when > does the server acknowledge receipt of your request, immediately or by > sending the finished page? Don't know enough about web servers and http to be sure). > > The other factor you are trying to measure is how much delay is there > in the server between the receipt of the request and the beginning of > processing. If PHP is being run as a CGI on this server, then the > server will need to load PHP, which will then load your script, which > will then begin executing your script (any one of these events could > be defined as beginning processing), and almost impossible to measure. > An idle server will begin your process without any delay, but if you > are concerned about this response time, I'm guessing the server is not > idle. > > You have a tough problem, wish I could offer more help, > > Warren Vail > > > -----Original Message----- > From: Tobias Grønlund [mailto:[EMAIL PROTECTED] > Sent: Wednesday, August 04, 2004 5:14 PM > To: [EMAIL PROTECTED] > Subject: Re: [PHP] Re: webserver response-time, how? > > > i meant time from i send the requestpacket to the server begins > processing the request, but i think that i have found a sollution now. > I've used microtime() to time how long it took to make a fsockopen() on > the webpage... schouldnt the output then be showing the result of my > problem?? > > Warren Vail wrote: > >>I support several PHPNuke sites and the page preparation time is >>measured by taking a microtime stamp at the very beginning of the >>script and another just before echoing the last couple of lines at the >>bottom of the page and producing something like the following on the >>bottom of the page; >> >>Page Generation: 0.376 Seconds >> >>This does not measure all the elements of delay, however, which can be >>broken down into the following; >> >>1. Time it takes for browser to get the request packet to the web >>server. 2. Time it take the web server to begin processing the >>request. 3. Time it takes to load PHP and for PHP to load your script >>(CGI or MOD?) >> >>4. Time it takes for your script to complete execution is measured >>above. >> >>5. Time it takes for the cached output from your script to be >>delivered back to the browser. 6. Time it takes to perform 1-5 above >>for any imbedded images, etc requests. 7. Time it takes for the >>browser to render the completed page. >> >>It's not clear from your question, which of these you wanted to >>measure. If you were to develop another application running on your >>local machine, then you could use things like socket connections to >>simulate a browser, invoke the page and measure the total span of >>time. In this case I would recommend using CURL, or Pears >>HTTP_REQUEST instead of dealing with the intricacies of building the >>request, etc. >> >>Hope this helps, >> >>Warren Vail >> >> >>-----Original Message----- >>From: Tobias Grønlund [mailto:[EMAIL PROTECTED] >>Sent: Wednesday, August 04, 2004 4:20 PM >>To: [EMAIL PROTECTED] >>Subject: [PHP] Re: webserver response-time, how? >> >> >>M. Sokolewicz wrote: >> >> >> >>>Tobias grønlund wrote: >>> >>> >>> >>>>Im trying to find a way of getting the responsetime from a remote >>>>webserver before it actually starts sending some output for your >>>>browser to read. Any ideas?? >>> >>>try timing the fsockopen() or (whatever you use) call. :) That'll >>>give >>>you a reasonable estimate. >>> >>>- Tul >>> >> >>how do i do that?? >> > > -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php