Skip to content

Commit 1e69354

Browse files
committed
Docker benchmark
1 parent 66bfeba commit 1e69354

File tree

4 files changed

+67
-17
lines changed

4 files changed

+67
-17
lines changed

README.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Simple demo application to test performances of [Fugerit Venus Doc](https://gith
77
[![code of conduct](https://img.shields.io/badge/conduct-Contributor%20Covenant-purple.svg)](https://github.com/fugerit-org/fj-doc-quarkus-demo/blob/main/CODE_OF_CONDUCT.md)
88
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=fugerit-org_fj-doc-quarkus-demo&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=fugerit-org_fj-doc-quarkus-demo)
99
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=fugerit-org_fj-doc-quarkus-demo&metric=coverage)](https://sonarcloud.io/summary/new_code?id=fugerit-org_fj-doc-quarkus-demo)
10+
[![Docker images](https://img.shields.io/badge/dockerhub-images-important.svg?logo=Docker)](https://hub.docker.com/repository/docker/fugeritorg/fj-doc-quarkus-demo/general)
1011

1112
[![Java version](https://img.shields.io/badge/JD-java%2021+-%23113366.svg?style=for-the-badge&logo=openjdk&logoColor=white)](https://universe.fugerit.org/src/docs/versions/java21.html)
1213
[![Apache Maven](https://img.shields.io/badge/Apache%20Maven-3.9.0+-C71A36?style=for-the-badge&logo=Apache%20Maven&logoColor=white)](https://universe.fugerit.org/src/docs/versions/maven3_9.html)
@@ -122,3 +123,18 @@ And here is some samples
122123
| 8.5.0 | AMD Ryzen 3700X 32gb (Ubuntu 22) | Oracle GraalVM 21 | 28.07s, 1781.52 req/s, 29.86MB/s | 19.66s, 2543.10 req/s, 42.63MB/s | 40.91s, 1222.29 req/s, 11.61MB/s | [2024-08-03](src/test/resources/benchmark_out/2024-08-03/ryzen_3700X) | h2load, 50000 request, 60 clients, 4 threads |
123124
| 8.5.0 | AMD Ryzen 9 3900X (24) @ 3.800GHz 128gb (Fedora 40) | OpenJDK Red Hat 21 | 20.16s, 2479.60 req/s, 41.59MB/s | 16.94s, 2951.92 req/s, 49.51MB/s | 25.30s, 1976.29 req/s, 18.93MB/s | [2024-08-03](src/test/resources/benchmark_out/2024-08-03/ryzen_9_3900X) | h2load, 50000 request, 60 clients, 4 threads |
124125

126+
## Benchmark with docker
127+
128+
### Starting cointainer (default is 1200m and 4 cpu maximu)
129+
130+
```shell
131+
docker compose -f src/main/docker/docker-compose.yml up -d
132+
```
133+
134+
### Run benchmark
135+
136+
```shell
137+
export NO_START=1;./src/main/script/bench-graph-h2-load-complete.sh
138+
```
139+
140+
You will need the NO_START=1 environment variable, so quarkus app will not be started by the script

src/main/docker/docker-compose.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: '3.8'
2+
# Define the services
3+
services:
4+
fj-doc-quarkus-demo:
5+
image: fugeritorg/fj-doc-quarkus-demo:v1.1.0
6+
container_name: fj-doc-quarkus-demo
7+
restart: always
8+
environment:
9+
- JAVA_OPTS_APPEND= -Xmx1024m
10+
ports:
11+
- "8080:8080"
12+
deploy:
13+
resources:
14+
limits:
15+
cpus: '4.0'
16+
memory: 1200M
17+
reservations:
18+
cpus: '1.0'
19+
memory: 512M

src/main/script/bench-graph-h2-load-complete.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,16 @@
44
#
55
# Author: Matteo Franci <[email protected]>
66

7+
# environments :
8+
# NO_START - if set to '1' quarkus will not be started and no plotting will be performed
9+
710
BASE_DIR=target
811
echo "1. Maven clean package"
9-
mvn clean package > ${BASE_DIR}/benchmark_log.txt 2>&1
12+
if [ "${NO_START}" = "1" ]; then
13+
echo "NO_START build skipped" > ${BASE_DIR}/benchmark_log.txt 2>&1
14+
else
15+
mvn clean package > ${BASE_DIR}/benchmark_log.txt 2>&1
16+
fi
1017
HANDLERS=(pdf-fop pdf-fop-pool openpdf)
1118
echo "2. Running benchmark"
1219
for docHandler in ${HANDLERS[@]}; do

src/main/script/bench-graph-h2-load.sh

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@
1010
# $3 (optional, default 60) - number of clients
1111
# $4 (optional, default 4) - number of threads
1212
#
13+
# environments :
14+
# NO_START - if set to '1' quarkus will not be started and no plotting will be performed
15+
#
1316
# to run this script :
1417
# - clone project : https://github.com/fugerit-org/fj-doc-quarkus-demo
1518
# - from the project root : 'mvn clean package' (requires jdk 21)
@@ -57,7 +60,9 @@ if [ ! -f ./${BASE_DIR}/quarkus-app/quarkus-run.jar ]; then
5760
fi
5861

5962
# check if quarkus app is running
60-
if [ -n "$(lsof -ti :8080)" ]; then
63+
if [ "${NO_START}" = "1" ]; then
64+
echo "NO_START flag = 1, assuming quarkus is already started"
65+
elif [ -n "$(lsof -ti :8080)" ]; then
6166
echo "It seems that Quarkus app is already running, please stop it first"
6267
echo "TCP ports in use :"
6368
echo "$(lsof -ti :8080 | xargs -r ps -o pid,cmd -p)"
@@ -67,13 +72,15 @@ fi
6772

6873
echo "Running with arguments : HANDLER=${HANDLER}, NUMBER_OF_REQUESTS=${NUMBER_OF_REQUESTS}, NUMBER_OF_CLIENTS=${NUMBER_OF_CLIENTS}, URL_PARAM=${URL_PARAM}"
6974

70-
java -Xmx1024m -jar ./${BASE_DIR}/quarkus-app/quarkus-run.jar &
71-
export PID=$!
72-
if [ -x "$(command -v psrecord)" ]; then
73-
echo "psrecord installed, plotting process : ${PID}"
74-
psrecord $PID --plot "${BASE_DIR}/out_${OUTPUT_BASE}.png" --include-children &
75-
else
76-
echo "psrecord not installed, plotting skipped for process : ${PID}"
75+
if [ "${NO_START}" != "1" ]; then
76+
java -Xmx1024m -jar ./${BASE_DIR}/quarkus-app/quarkus-run.jar &
77+
export PID=$!
78+
if [ -x "$(command -v psrecord)" ]; then
79+
echo "psrecord installed, plotting process : ${PID}"
80+
psrecord $PID --plot "${BASE_DIR}/out_${OUTPUT_BASE}.png" --include-children &
81+
else
82+
echo "psrecord not installed, plotting skipped for process : ${PID}"
83+
fi
7784
fi
7885

7986
sleep 8
@@ -87,15 +94,16 @@ h2load -n${NUMBER_OF_REQUESTS} -c${NUMBER_OF_CLIENTS} -t${NUMBER_OF_THREADS} --w
8794

8895

8996
print "JVM run done!🎉"
90-
print "Killing process ${PID}"
91-
92-
# try to kill the process
93-
kill $PID
9497

95-
#check if quarkus app is still running
96-
if [ -n "$(lsof -ti :8080)" ]; then
97-
echo "Quarkus app is still running, killing it"
98-
kill -9 $(lsof -ti :8080)
98+
if [ "${NO_START}" != "1" ]; then
99+
print "Killing process ${PID}"
100+
# try to kill the process
101+
kill $PID
102+
#check if quarkus app is still running
103+
if [ -n "$(lsof -ti :8080)" ]; then
104+
echo "Quarkus app is still running, killing it"
105+
kill -9 $(lsof -ti :8080)
106+
fi
99107
fi
100108

101109
print "The benchmark results are in ${BASE_DIR}/target folder"

0 commit comments

Comments
 (0)