cpp_server/stress_test.sh

24 lines
508 B
Bash
Executable File

#!/bin/bash
urls=(
"http://localhost:8080/"
"http://localhost:8080/request-info"
"http://localhost:8080/users/boobs"
"http://localhost:8080/index.html"
)
pids=()
for i in "${!urls[@]}"; do
bombardier -c 25 -d 30s -p r "${urls[$i]}" > "/tmp/bombardier_$i.out" 2>&1 &
pids+=($!)
done
for pid in "${pids[@]}"; do
wait $pid
done
for i in "${!urls[@]}"; do
reqs_sec=$(grep "Reqs/sec" "/tmp/bombardier_$i.out" | awk '{print $2}')
echo "${urls[$i]}: $reqs_sec req/sec"
rm "/tmp/bombardier_$i.out"
done