JMH – the OpenJDK tool

Java Microbenchmark Harness (JMH) is a small library developed by the OpenJDK team—yes, the same one doing the JVM—which enables you to easily develop microbenchmarks.

A microbenchmark designs a benchmark on a very small part of an application. Most of the time, you can see it as a unit benchmark, using the analogy with unit tests.

Yet, it is something important when setting up performance tests as it will allow you to quickly identify a critical performance regression introduced by a recent change. The idea is to associate each benchmark with a small part of code, whereas a benchmark will include several layers. So, if the benchmark fails, you will spend a lot of time identifying why, instead of simply checking the ...

Get Java EE 8 High Performance now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.