Skip to content

Instantly share code, notes, and snippets.

@gotev
Last active April 27, 2016 06:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save gotev/2db148a8b224d488cf4300a242bb3a78 to your computer and use it in GitHub Desktop.
Save gotev/2db148a8b224d488cf4300a242bb3a78 to your computer and use it in GitHub Desktop.
Measure website performance
#!/bin/bash
if [ "x$1" == "x" ]
then
echo "Usage: ./website-performance.sh <website_to_check>"
exit 1
fi
TEMPFILE=$(mktemp)
cat <<EOF > $TEMPFILE
time_namelookup: %{time_namelookup}\n
time_connect: %{time_connect}\n
time_appconnect: %{time_appconnect}\n
time_pretransfer: %{time_pretransfer}\n
time_redirect: %{time_redirect}\n
time_starttransfer: %{time_starttransfer}\n
----------\n
time_total: %{time_total}\n
EOF
curl -w "@$TEMPFILE" -o /dev/null -s "$1"
rm -rf $TEMPFILE
@gotev
Copy link
Author

gotev commented Apr 27, 2016

Website performance

Measures the performance of a particular web site or web page. Runs on UNIX systems and requires only curl. Just copy and paste it and make it runnable. The idea was taken from this StackOverflow question

Example output:

./website-performance.sh www.yoursite.com
    time_namelookup:  0,002
       time_connect:  0,087
    time_appconnect:  0,000
   time_pretransfer:  0,087
      time_redirect:  0,000
 time_starttransfer:  0,539
                    ----------
         time_total:  0,539

To install it on your box, just copy and paste this on your terminal and enter the password when prompted:

curl -L https://gist.github.com/gotev/2db148a8b224d488cf4300a242bb3a78/raw/22dfc06419640a4cc122f208e81b2803a67ede41/website-performance.sh -o website-performance.sh && sudo chmod +x website-performance.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment