2016-04-08 10:04:46 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
|
|
|
# Example: time /bin/bash ./ramp.sh
|
|
|
|
#
|
2016-04-08 10:05:47 +00:00
|
|
|
# Every iteration we'll increase the number of concurrent users by 50
|
|
|
|
# Each iteration adds an aditional 5 minutes (300s)
|
2016-04-08 10:04:46 +00:00
|
|
|
# So after 75 minutes we'll reach our final iteration
|
|
|
|
# Which will then run for 30mins and will push through 300 concurrent requests a second over that period
|
|
|
|
# So on the last iteration we'll hit the service 540,000 times over the last 30 minutes period (300*1800)
|
|
|
|
|
|
|
|
rates=(50 100 150 200 250 300)
|
|
|
|
durations=(300s 600s 900s 1200s 1500s 1800s)
|
|
|
|
url="https://routing.mozart.test.api.bbci.co.uk/news/topics/2611f753-ece7-47ea-9782-f912bc1e4088/film"
|
|
|
|
|
|
|
|
for i in $(seq 0 5); do
|
2016-04-08 10:10:51 +00:00
|
|
|
printf "\t- rate: ${rates[$i]} rps | duration: $((${durations[$i]} / 60)) mins\n"
|
2016-04-08 10:04:46 +00:00
|
|
|
echo "GET $url" | ./vegeta attack -rate="${rates[$i]}" -duration="${durations[$i]}" -insecure > "results-${i}.bin"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Main result
|
|
|
|
printf "\n\nCombined results:\n\n"
|
|
|
|
./vegeta report -inputs="$(echo results-*.bin | tr ' ' ',')"
|
|
|
|
|
|
|
|
# Individual results
|
|
|
|
printf "\n\nIndividual results:\n\n"
|
|
|
|
for i in $(seq 0 5); do
|
|
|
|
cat "results-${i}.bin" | ./vegeta report
|
|
|
|
printf "\n\n"
|
|
|
|
done
|
|
|
|
|
|
|
|
# Cleanup
|
|
|
|
for i in $(seq 0 5); do
|
|
|
|
rm "results-${i}.bin"
|
|
|
|
done
|