Measure website response time through curl

In this article I will show you how you can get the response time of any damn website.I am going to use curl for that purpose.As we know curl is extremly powerful to fetch lot many thing.I got this idea from one of IBM DW article and wrote a script to do just that for me.So here is the script I write:


1 #!/bin/bash
2 CURL="/usr/bin/curl"
3 GAWK="/usr/bin/gawk"
4 echo -n "Please pass the url you want to measure: "
5 read url
6 URL="$url"
7 result=`$CURL -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} $URL`
8 echo " Time_Connect Time_startTransfer Time_total "
9 echo $result | $GAWK -F: '{ print $1" "$2" "$3}'

This is very ordinary script but it does the job it was intended to do.Here is the interaction with script below:

bhaskar@bhaskar-laptop_09:02:55_Fri Nov 12:/lvm/Adm_scripts> sudo ./measure_website_response
Please pass the url you want to measure: http://justlinux.com
Time_Connect Time_startTransfer Time_total
1.122 3.455 9.205

Hope this will help.

Cheers!
Bhaskar

About unixbhaskar
GNU/Linux Consultant

8 Responses to Measure website response time through curl

  1. Pingback: Links 14/11/2010: Scientific Linux 6.0 Alpha, Fedora and Wayland | Techrights

  2. Wonderful post, very informative. I ponder why the other specialists of this sector don’t notice this. You should continue your writing. I am sure, you have a huge readers’ base already!|What’s Happening i’m new to this, I stumbled upon this I have found It positively helpful and it has aided me out loads. I am hoping to contribute & aid other customers like its aided me. Great job.

  3. aljensen says:

    Cool! I have just started shell scripting. I will definitely have to try this script out.

  4. Wayne says:

    I really like it, thx. I made a little change to use it in a loop and formatted the output.

    #!/bin/bash
    CURL=”/usr/bin/curl”
    GAWK=”/usr/bin/gawk”

    URL=”$1″
    result=`$CURL -o /dev/null -s -w %{time_connect}:%{time_starttransfer}:%{time_total} $URL`
    echo “Host: $URL”
    echo “Time_Connect Time_startTransfer Time_total
    $(echo $result | $GAWK -F: ‘{ print $1” “$2” “$3}’)
    ” | column -t

    :~# ./response_time.sh google.com
    Host: google.com
    Time_Connect Time_startTransfer Time_total
    0.088 0.138 0.138

  5. Pingback: A quick and dirty way of testing the performance of a service at Mark Needham

  6. ap says:

    What are you measuring actually ? Can you analyze the time ? Definitely it is not the total time the page takes to download on our machine.

  7. mariusv says:

    Why not: curl -o /dev/null -s -w %{time_total}\\n http://www.google.com ?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: