Created
November 18, 2009 15:24
-
-
Save tobym/237949 to your computer and use it in GitHub Desktop.
Website speed benchmarking with command line
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 }" |
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
apache bench?