-
Notifications
You must be signed in to change notification settings - Fork 0
/
benchmark-wrk.sh
executable file
·55 lines (50 loc) · 960 Bytes
/
benchmark-wrk.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
#!/usr/bin/env bash
trap 'kill -TERM $PID; exit' SIGINT
usage() {
echo "$0 <duration> <threads> <connections>"
}
if [[ -z "$1" ]]; then
usage
exit 1
fi
if [[ -z "$2" ]]; then
usage
exit 2
fi
if [[ -z "$3" ]]; then
usage
exit 3
fi
BASEDIR=$(dirname "$0")
for file in "${BASEDIR}"/*.jar ; do
echo "BENCHMARKING ${file/${BASEDIR}\//}"
echo " ASYNC"
${file} &> /dev/null &
PID=$!
DONE=0
while [[ $DONE -eq 0 ]]; do
if curl -s http://localhost:8080/ > /dev/null; then
sleep 1
wrk -d"$1" -t"$2" -c"$3" http://localhost:8080/async/benchmark/benchmarker/01189998819991197253
DONE=1
fi
sleep 1
done
kill -TERM $PID
wait
echo " SYNC"
${file} &> /dev/null &
PID=$!
DONE=0
while [[ $DONE -eq 0 ]]; do
if curl -s http://localhost:8080/ > /dev/null; then
sleep 1
wrk -d"$1" -t"$2" -c"$3" http://localhost:8080/sync/benchmark/benchmarker/01189998819991197253
DONE=1
fi
sleep 1
done
kill -TERM $PID
wait
echo ""
done