How to check the HTTP web server respond speed

alex wu alex298298 at yahoo.com
Tue Jan 3 06:02:42 EST 2006


Hello all,

Thanks for your assistance!

I modified the function according to your information.
 The Server_Speed of some top websites range from
0.013 to 0.025 seconds.  This seems to be more
reasonable.

function haveIPconnect
  put fld "domain" into theHostName
  if colon is not in theHostName then
    put colon & "80|test" after theHostName
  end if
  
  ## Record the start time
  put the long seconds into startTime

  open socket theHostName
  if theHostName is among the lines of the openSockets
then

    ##Write to socket while it's open
    write "h" to socket theHostName

    ## Calculate the response time
    put the long seconds - startTime into Server_Speed

    close socket theHostName
    return true
  else
    beep
    answer warning "The site may be down"
    return false
  end if
end haveIPconnect


Best regards

Alex

--- Alex Tweedly <alex at tweedly.net> wrote:

> alex wu wrote:
> 
> >Hello,
> >
> >I want to compare the speed of webservers.  I try
> to
> >use the following function.  However the respond
> time
> >(Server_Speed) of almost all servers I test is
> zero. 
> >I don't believe that the response speed of all
> >webservers are so fast - zero.  There must be some
> >problem with the way I calculate it.  Please help.
> >
> >  
> >
> Alex,
> 
> your problem is that "open socket" doesn't wait
> until the connection is 
> established. From the docs:
> 
> > When a connection is made, the open socket command
> creates a new 
> > socket that can be used to communicate with the
> other system. The 
> > handler continues executing while the connection
> is being established. 
> > If you use the write to socket command while the
> connection is 
> > opening, the data is buffered and is sent to the
> host as soon as the 
> > connection is made.
> 
> You should be able to write a single byte to the
> socket - write to 
> socket does pause until the write is completed so
> this should give you 
> valid timings.
> 
> ("valid timings" - this will give you approximately
> valid timings for 
> connection establishment - there's a lot more than
> that involved in the 
> overall speed of a web server, so I'd be very
> careful how much I read 
> into these results ...)
> 
> >function haveIPconnect
> >  put fld "domain" into theHostName
> >  if colon is not in theHostName then
> >    put colon & "80|test" after theHostName
> >  end if
> >  
> >  ## Record the start time
> >  put the long seconds into startTime
> >
> >  open socket theHostName
> >  
> >
> >  if theHostName is among the lines of the
> openSockets
> >then
> >
> >    ## Calculate the response time
> >    put the long seconds - startTime into
> Server_Speed
> >
> >    close socket theHostName
> >    return true
> >  else
> >    beep
> >    answer warning "The site may be down"
> >    return false
> >  end if
> >end haveIPconnect
> >
> >  
> >
> 
> -- 
> Alex Tweedly       http://www.tweedly.net
> 
> 
> 
> -- 
> No virus found in this outgoing message.
> Checked by AVG Free Edition.
> Version: 7.1.371 / Virus Database: 267.14.9/217 -
> Release Date: 30/12/2005
> 
> _______________________________________________
> use-revolution mailing list
> use-revolution at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and
> manage your subscription preferences:
>
http://lists.runrev.com/mailman/listinfo/use-revolution
> 



	
		
__________________________________ 
Yahoo! for Good - Make a difference this year. 
http://brand.yahoo.com/cybergivingweek2005/



More information about the use-livecode mailing list