Some examples for spotting potential performance regressions using JfrUnit. JfrUnit must be installed into the local Maven repository. Alternatively, adjust the JfrUnit dependency in example-service/pom.xml to the JitPack coordinates specified in the README in the JfrUnit repository.
This project requires OpenJDK 15 or later for its build. Apache Maven is used for the build.
Run the following to build the project:
cd user-service
mvn clean verify
java -Dquarkus.http.port=8082 -jar target/jfrunit-demo-user-1.0.0-SNAPSHOT-runner.jar
This starts the "user" service, which is accessed by the example service within one of the regression scenarios. Then build the example service itself:
cd example-service
mvn clean verify
In each test class, there's a method ...Regression()
with an assertion that's commented out.
When commenting it in, this test should fail due to a performance "regresssion",
e.g. due to higher memory allocation than expected, more IO, or more SQL statements.
When running the TodoResourceSqlStatementsTest
in your IDE, make sure to specify the correct JMC Agent configuration,
as seen in the example-service/pom.xml file.
For manual testing, build the application, start a separate Postgres instance via Docker Compose and launch the app like so:
docker-compose up
cd example-service
clean verify -DskipTests=true
java -jar ./example-service/target/quarkus-app/quarkus-run.jar
# Testing, e.g. via httpie
http POST localhost:8080/todo title=Test priority=2 completed=true
This code base is available under the Apache License, version 2.