-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathjvm-tuning-benchmark.sh
87 lines (79 loc) · 3.28 KB
/
jvm-tuning-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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
#!/usr/bin/env bash
#
# Generate data for JVM tuning experiments
# 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 "Untuned JVM server"
echo "Warming up"
java -jar target/scala-2.13/http4s-native-image-assembly-0.1.0-SNAPSHOT.jar > jvm-log.txt &
SERVER_PID=$!
SLEEP 5
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
# Give some time for GC to run
sleep 5
echo "-----------------------------------------"
echo "Untuned JVM Benchmark Run"
echo "-----------------------------------------"
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-untuned.csv ${URL}
kill ${SERVER_PID}
sleep 5
echo "GC tuned JVM server"
echo "Warming up"
java -XX:MaxGCPauseMillis=200 -jar target/scala-2.13/http4s-native-image-assembly-0.1.0-SNAPSHOT.jar > jvm-log.txt &
SERVER_PID=$!
SLEEP 5
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
# Give some time for GC to run
sleep 5
echo "-----------------------------------------"
echo "GC Tuned JVM Benchmark Run"
echo "-----------------------------------------"
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-gc-tuned.csv ${URL}
kill ${SERVER_PID}
sleep 5
echo "Compiler tuned JVM server"
echo "Warming up"
java -Dgraal.TrivialInliningSize=21 -Dgraal.MaximumInliningSize=450 -Dgraal.SmallCompiledLowLevelGraphSize=550 -jar target/scala-2.13/http4s-native-image-assembly-0.1.0-SNAPSHOT.jar > jvm-log.txt &
SERVER_PID=$!
SLEEP 5
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
ab -dSq -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
# Give some time for GC to run
sleep 5
echo "-----------------------------------------"
echo "Compiler Tuned JVM Benchmark Run"
echo "-----------------------------------------"
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-compiler-tuned.csv ${URL}
kill ${SERVER_PID}
sleep 5
echo "Compiler + GC tuned JVM server"
echo "Warming up"
java -XX:MaxGCPauseMillis=200 -Dgraal.TrivialInliningSize=21 -Dgraal.MaximumInliningSize=450 -Dgraal.SmallCompiledLowLevelGraphSize=550 -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} ${URL}
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} ${URL}
# Give some time for GC to run
sleep 5
echo "-----------------------------------------"
echo "Both Tuned JVM Benchmark Run"
echo "-----------------------------------------"
ab -n ${ITERATIONS} -c ${CONCURRENCY} -s ${TIMEOUT} -e jvm-both-tuned.csv ${URL}
kill ${SERVER_PID}
sleep 5