Last active
January 3, 2016 15:38
-
-
Save oremj/8483782 to your computer and use it in GitHub Desktop.
Use AWS hosts for vegeta load test.
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
#!/bin/bash | |
# assumes hosts are tagged with tag_Name_marketplace-stage-loadtest | |
# ansible tag_Name_marketplace-stage-loadtest -m copy -a "src=./vegeta dest=/tmp/vegeta" to copy vegeta to the load test hosts. | |
set -e | |
URL='https://marketplace.allizom.org/' | |
RATE=10 | |
DURATION="1s" | |
TMPDIR="$(mktemp -d)" | |
TMPFILE="$(mktemp)" | |
trap "rm -rf \"${TMPDIR}\" \"${TMPFILE}\"" EXIT | |
cat > "${TMPFILE}" <<SCRIPT | |
ulimit -n 100000 | |
echo 'GET ${URL}' | /tmp/vegeta attack -rate=${RATE} -duration=${DURATION} -output=/tmp/vegeta.result | |
SCRIPT | |
reports="" | |
for h in $(ansible --list-hosts tag_Name_marketplace-stage-loadtest); do | |
scp -q "${TMPFILE}" "$h":"${TMPFILE}" | |
( | |
ssh -tt -q "$h" "sudo /bin/bash \"${TMPFILE}\"" | |
scp -q "$h":/tmp/vegeta.result "${TMPDIR}/$h.vr" | |
) & | |
reports=",${TMPDIR}/$h.vr" | |
done | |
wait | |
reports=${reports:1} | |
./vegeta report -input="${reports}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment