Microbenchmarks are written using JMH. To execute them, first build the JAR:
$ ./mvnw -T 1C package -DskipTests=true
Then run the JAR:
$ java -jar benchmarks/target/benchmarks.jar
The java version needs to be equal or greater than the configured toolchain.
Maven automatically downloads the JDK when it is missing and it should be
available in ~/.m2/jdks/jdk-<version>
.
To get the configured JDK version, use:
$ ./mvnw help:evaluate -Dexpression=versions.jdk -q -DforceStdout
If you want to execute specific benchmarks you can provide a filter argument:
$ java -jar benchmarks/target/benchmarks.jar <benchmarkMethodName | benchmarkClassName>"
To save the results to a file, use the -rf
and -rff
options:
$ java -jar benchmarks/target/benchmarks.jar -rf json -rff /tmp/jmh.json
If you are writing new benchmarks, take a look at this JMH introduction and these JMH samples.
Version-independent benchmarks which can be written using regular SQL statements are in the crate-benchmarks repository.