-
Notifications
You must be signed in to change notification settings - Fork 4
/
sustained-benchmark.sh
51 lines (45 loc) · 1.67 KB
/
sustained-benchmark.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
#!/usr/bin/env bash
#
# Measure sustained performance under load
# number of iterations to run per server
ITERATIONS=10000
# maximum number of concurrent requests
CONCURRENCY=50
# URL to test
URL=http://localhost:8080/ping/hi
# ab stops after timeout seconds regardless of how many requests it has sent
TIMEOUT=300
echo "Benchmarking Native Image server"
./out/ping-server.local > local-log.txt &
SERVER_PID=$!
SLEEP 5
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e native-image-sustained.csv ${URL}
kill ${SERVER_PID}
# Give some time for shutdown to complete
sleep 5
echo "Benchmarking cold JVM server"
java -jar target/scala-2.13/http4s-native-image-assembly-0.1.0-SNAPSHOT.jar > jvm-log.txt &
SERVER_PID=$!
SLEEP 5
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-cold-sustained.csv ${URL}
# Give some time for GC to run
sleep 5
echo "Benchmarking warm JVM server"
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-warm-sustained-1.csv ${URL}
sleep 5
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-warm-sustained-2.csv ${URL}
sleep 5
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-warm-sustained-3.csv ${URL}
sleep 5
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-warm-sustained-4.csv ${URL}
sleep 5
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-warm-sustained-5.csv ${URL}
sleep 5
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-warm-sustained-6.csv ${URL}
sleep 5
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-warm-sustained-7.csv ${URL}
sleep 5
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-warm-sustained-8.csv ${URL}
kill ${SERVER_PID}
# Give some time for shutdown to complete
sleep 5