Skip to content

Instantly share code, notes, and snippets.

@tobym
Created November 18, 2009 15:24
Show Gist options
  • Save tobym/237949 to your computer and use it in GitHub Desktop.
Save tobym/237949 to your computer and use it in GitHub Desktop.
Website speed benchmarking with command line
# time how long it takes to load your website 100 times and save it to "non_cached.txt"
for i in {1..100}
do
time (curl http://www.yourwebsite.com > /dev/null 2> /dev/null) 2>> non_cached.txt
done
# Set up caching or whatever performance tweaks you need, then run it again (saving to different file)
for i in {1..100}
do
time (curl http://www.yourwebsite.com > /dev/null 2> /dev/null) 2>> cached.txt
done
# save the following to ./get_averages.sh and run like: ./get_averages.sh cached.txt real
# first argument is the filename and the second is either "real", "user", or "sys".
#!/bin/bash
cat $1 | sed 's/0m\(.....\)/0m \1 /' | awk "/$2/ { sum += \$3; num+=1 } END { print \"$2 average = \", sum/num }"
@ChrisLundquist
Copy link

apache bench?

@tobym
Copy link
Author

tobym commented Jun 17, 2010

yes, ab would have been far superior. I didn't have it on that system at the time.

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