Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Microbenchmarking with JMH - Portland 2023-03-14

sullis
March 14, 2023

Microbenchmarking with JMH - Portland 2023-03-14

Microbenchmarking with JMH
Portland Java User Group
March 14, 2023
Portland Oregon

sullis

March 14, 2023
Tweet

More Decks by sullis

Other Decks in Programming

Transcript

  1. Java Microbenchmark Harness “JMH is a Java harness for building,

    running, and analysing nano/micro/milli/macro benchmarks written in Java and other languages targeting the JVM.”
  2. OSS projects that use JMH • Netty • Log4j2 •

    Spring Framework • Apache Cassandra • Apache Kafka • Netflix Atlas • Netflix Spectator • Netflix Zuul
  3. NOTE: JMH is not intended to be used in the

    same way as a typical testing library such as JUnit. Simply adding the jmh-core jar file to your build is not enough to be able to run benchmarks.
  4. “the key to using JMH is enabling the annotation- or

    bytecode-processors to generate the synthetic benchmark code”
  5. “Running benchmarks from the IDE is generally not recommended due

    to generally uncontrolled environment in which the benchmarks run.”
  6. CompressionBenchmark • Goal: measure throughput of Gzip compression • Goal:

    measure throughput of Brotli compression • Goal: evaluate Brotli compression parameters
  7. CompressionBenchmark # JMH version: 1.36 # VM version: JDK 17.0.6,

    OpenJDK 64-Bit Server VM, 17.0.6+10-LTS # Warmup: 2 iterations, 10 s each # Measurement: 5 iterations, 10 s each # Threads: 1 thread, will synchronize iterations # Benchmark mode: Throughput, ops/time