Skip to content

Commit

Permalink
Use ZGC garbage collector to run the app (not supported for native bi…
Browse files Browse the repository at this point in the history
…naries)
  • Loading branch information
miguno committed May 7, 2024
1 parent e0a6989 commit 85786d0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,4 @@ COPY --from=builder --chown=$USER_NAME:$GROUP_NAME /usr/src/myapp/target/app-run
# Run the application.
USER $USER_NAME:$GROUP_NAME
EXPOSE 8123
ENTRYPOINT ["java", "-jar", "./app.jar"]
ENTRYPOINT ["java", "-XX:+UseZGC", "-XX:+ZGenerational", "-jar", "./app.jar"]
8 changes: 7 additions & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ run:
echo "Using existing application uber jar at $APP_JAR."
echo "If you want to recompile the uber jar, run \`./mvnw package\` (or \`just package\`) manually."
fi
java -jar "$APP_JAR"
declare -r JVM_ARGS="-XX:+UseZGC -XX:+ZGenerational"
java $JVM_ARGS -jar "$APP_JAR"
# run the native application locally (requires GraalVM)
run-native:
Expand All @@ -118,6 +119,11 @@ run-native:
echo "Using existing application native image at $APP_BINARY."
echo "If you want to recompile the native image, run \`./mvnw install -Dnative\` (or \`just build-native\`)."
fi
# To see garbage collection statistics, run the native binary as follows.
#
# "$APP_BINARY" -XX:+PrintGC -XX:+VerboseGC
#
# See https://quarkus.io/guides/native-reference for further information.
"$APP_BINARY"
# generate site incl. reports for spotbugs, dependencies, javadocs, licenses
Expand Down

0 comments on commit 85786d0

Please sign in to comment.