Measuring response time from a URL
Measuring response time from a URL
am 02.04.2008 16:24:29 von zmasood
Hi All,
I want to execute a shell script which returns the response time from
a URL (using wget(?)). Can this be done through a shell script and
how? The OS in linux.
Thanks in advance,
ZM
Re: Measuring response time from a URL
am 02.04.2008 16:42:02 von Ed Morton
On 4/2/2008 9:24 AM, Zinger wrote:
> Hi All,
>
> I want to execute a shell script which returns the response time from
> a URL (using wget(?)). Can this be done through a shell script and
> how? The OS in linux.
"time" may be all you need:
$ time curl http://www.gnu.org/index.html >/dev/null 2>&1
real 0m0.304s
user 0m0.030s
sys 0m0.077s
Depends what you're really looking for...
Regards,
Ed.
Re: Measuring response time from a URL
am 02.04.2008 17:06:51 von PK
Zinger wrote:
> Hi All,
>
> I want to execute a shell script which returns the response time from
> a URL (using wget(?)). Can this be done through a shell script and
> how? The OS in linux.
Don't know what you mean by "response time", however try this:
$ time wget your://url.here
--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.
Re: Measuring response time from a URL
am 02.04.2008 17:43:28 von Chris Mattern
On 2008-04-02, Zinger wrote:
> Hi All,
>
> I want to execute a shell script which returns the response time from
> a URL (using wget(?)). Can this be done through a shell script and
> how? The OS in linux.
>
>
> Thanks in advance,
>
> ZM
>
time wget http://example.com/website
--
Christopher Mattern
NOTICE
Thank you for noticing this new notice
Your noticing it has been noted
And will be reported to the authorities
Re: Measuring response time from a URL
am 02.04.2008 18:12:35 von zmasood
On Apr 2, 11:43 am, Chris Mattern wrote:
> On 2008-04-02, Zinger wrote:> Hi All,
>
> > I want to execute a shell script which returns the response time from
> > a URL (using wget(?)). Can this be done through a shell script and
> > how? The OS in linux.
>
> > Thanks in advance,
>
> > ZM
>
> time wgethttp://example.com/website
>
> --
> Christopher Mattern
>
> NOTICE
> Thank you for noticing this new notice
> Your noticing it has been noted
> And will be reported to the authorities
Hi,
Thanks. As I mentioned, I am interested in how quickly the page I am
trying to get opens up. So would "time" get me the response time from
the URL? e.g. how long did the cnn.com page took to say open up (just
as in it would have opened through a browser) in the example below? If
yes then what is the value of response time? Is it 0.411seconds?
==================
time wget cnn.com
--12:07:27-- http://cnn.com/
=> `index.html'
Resolving cnn.com... 64.236.16.20, 64.236.16.52, 64.236.24.12, ...
Connecting to cnn.com[64.236.16.20]:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://www.cnn.com/ [following]
--12:07:27-- http://www.cnn.com/
=> `index.html'
Resolving www.cnn.com... 64.236.24.12, 64.236.29.120,
64.236.91.21, ...
Connecting to www.cnn.com[64.236.24.12]:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 91,412 [text/html]
100%
[=========================================================== =======================================>]
91,412 495.93K/s
12:07:27 (494.95 KB/s) - `index.html' saved [91,412/91,412]
real 0m0.411s
user 0m0.003s
sys 0m0.002s
==========================
Re: Measuring response time from a URL
am 02.04.2008 18:46:32 von PK
Zinger wrote:
> Hi,
>
> Thanks. As I mentioned, I am interested in how quickly the page I am
> trying to get opens up.
> So would "time" get me the response time from the URL? e.g. how long did
> the cnn.com page took to say open up (just as in it would have opened
> through a browser) in the example below?
So it seems you want to know the time it takes to see the page completely
loaded in your browser (thus including objects referenced by that page).
Note that his time may be different from the time needed to transfer all the
objects across the network, since some objects (eg, java applets, flash
movies) may need some time to initialize inside the browser, even when the
page is already loaded.
Also, there are other factors that affect the overall time, such as DNS
lookups.
That said, the -p option to wget may probably suit your needs. From the man
page (which you should read anyway):
-p
--page-requisites
This option causes Wget to download all the files that are necessary to
properly display a given HTML page. This includes such things as
inlined images, sounds, and referenced stylesheets.
Read the man page, especially the full description for the -p option. You
may want to use additional options, as indicated.
> If yes then what is the value of response time? Is it 0.411seconds?
>[cut]
> real 0m0.411s
> user 0m0.003s
> sys 0m0.002s
> ==========================
man time.
The elapsed time is the one listed as "real".
--
All the commands are tested with bash and GNU tools, so they may use
nonstandard features. I try to mention when something is nonstandard (if
I'm aware of that), but I may miss something. Corrections are welcome.