Welcome to the Java JMH Benchmark Template Repository. This repository provides a ready-to-use template to help you quickly set up and run benchmarks using the Java Microbenchmark Harness (JMH).
You can find samples of JMH at https://github.com/openjdk/jmh/tree/master/jmh-samples/src/main/java/org/openjdk/jmh/samples
Template parts:
- Service with business logic
- Benchmark
- Tests placeholder
Dependencies:
- JMH dependency
- JUnit5
- Assertj
- fmt-maven-plugin
Also:
- Jar with dependencies build
- Dockerfile
- Clone repository
- Change
AppService
- Change
AppServiceTest
- Change benchmark
SampleBenchmark
- Execute benchmark from
Main
mvn package
java -jar target/jmh-benchmark-1.0-SNAPSHOT-jar-with-dependencies.jar
docker build -f src/main/docker/Dockerfile .
or
docker run $(docker build -f src/main/docker/Dockerfile . -qq)
Author of this template is Mark Andreev ( MrkAndreev.name, LinkedIn )