-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathbenchmark.sh
executable file
·94 lines (74 loc) · 3.34 KB
/
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
88
89
90
91
92
93
94
#!/bin/bash
function finish {
docker network rm neo4j-tck &>/dev/null
}
trap finish EXIT
docker network create neo4j-tck &>/dev/null
(cd tck && ./mvnw -DskipTests clean test-compile package)
declare -a projects=(
"helidon-se-reactive"
"helidon-se-reactive-native"
"micronaut-imperative"
"micronaut-reactive"
"micronaut-reactive-native"
"quarkus-imperative"
"quarkus-imperative-native"
"quarkus-ogm"
"quarkus-ogm-native"
"quarkus-reactive"
"quarkus-reactive-native"
"spring-boot23-with-sdn-ogm"
"spring-boot24-with-sdn-ogm"
"spring-data-imperative"
"spring-data-imperative-native"
"spring-data-reactive"
"spring-plain-imperative"
"spring-plain-reactive"
)
declare -t prefix=neo4j-from-the-jvm
for underTest in "${projects[@]}"; do
printf "Benchmarking $underTest\n"
docker run --name neo4j --publish=7687 -e 'NEO4J_AUTH=neo4j/secret' -e 'NEO4J_dbms_memory_pagecache_size=1024M' -e 'NEO4J_dbms_memory_heap_max__size=1024M' -d --network neo4j-tck neo4j:4.1 &>/dev/null
export NEO4J_BOLT=`docker inspect --format='{{(index (index .NetworkSettings.Ports "7687/tcp") 0).HostPort}}' neo4j` &>/dev/null
export NEO4J_IP=`docker inspect --format='{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' neo4j` &>/dev/null
# Wait for Neo4j to be happy.
java -jar tck/target/tck-1.0.0-SNAPSHOT.jar --spring.neo4j.uri=bolt://localhost:$NEO4J_BOLT verifyConnection -t PT120S
# Load the movie graph
java -jar tck/target/tck-1.0.0-SNAPSHOT.jar --spring.neo4j.uri=bolt://localhost:$NEO4J_BOLT loadMovies
time {
if [[ $underTest = helidon* ]]
then
docker run --name underTest --publish=8080 -e "NEO4J_URI=bolt://$NEO4J_IP:7687" --network neo4j-tck -d $prefix/$underTest &>/dev/null
elif [[ $underTest = micronaut* ]]
then
docker run --name underTest --publish=8080 -e 'NEO4J_URI=bolt://neo4j:7687' --network neo4j-tck -d $prefix/$underTest &>/dev/null
elif [[ $underTest = quarkus* ]]
then
docker run --name underTest --publish=8080 -e 'QUARKUS_NEO4J_URI=bolt://neo4j:7687' --network neo4j-tck -d $prefix/$underTest &>/dev/null
elif [[ $underTest = spring-boot23-* ]]
then
docker run --name underTest --publish=8080 -e 'ORG_NEO4J_DRIVER_URI=bolt://neo4j:7687' --network neo4j-tck -d $prefix/$underTest &>/dev/null
elif [[ $underTest = spring* ]]
then
docker run --name underTest --publish=8080 -e 'SPRING_NEO4J_URI=bolt://neo4j:7687' --network neo4j-tck -d $prefix/$underTest &>/dev/null
else
echo "No match"
fi
EXPOSED_PORT=`docker inspect --format='{{(index (index .NetworkSettings.Ports "8080/tcp") 0).HostPort}}' underTest`
printf 'Waiting for container to start'
while [ "$(curl --silent --fail-early -H 'Accept: application/json' http://localhost:$EXPOSED_PORT/management/health/readiness | jq -e '.status == "UP"')" != "true" ]; do
printf '.'
sleep 0.1
done
printf '\n'
}
echo "Container resource usage before"
docker stats underTest --no-stream --format "table {{.CPUPerc}}\t{{.MemUsage}}"
echo "http://localhost:$EXPOSED_PORT/api/movies"
apib -c20 -d60 http://localhost:$EXPOSED_PORT/api/movies
echo "Container resource usage after"
docker stats underTest --no-stream --format "table {{.CPUPerc}}\t{{.MemUsage}}"
docker rm -f underTest &>/dev/null
docker rm -f neo4j &>/dev/null
sleep 2
done