Java performance tuning - VisualVM

When profiling methods or in general looking for bottlenecks the current tool to use is VisualVM for openjdk 13+

In comparision to older tools (like Java Misson Control), I was pleasantly suprised at it's ease of use.

You simply start your java app, then fire up VisualVm, attach to the process and navigate to the Profiler.

From here all you have to do is press the CPU Button, wait until the GUI becomes responsive again. After that all methods that your jvm executes will automatically be profiled.

So head over to your application, execute whatever you want to profile, wait for it to finish and then come back to the Profiler. You now can hit the "stop" button and start analysing the recordings.

Method invocations are listed by thread, search for the relevant once and then start drilling down. You can traverse the entire call stack and see exactly how long each part took. This way you can easily identify bottlenecks and also learn a thing or two about what actually makes programs fast and what slows them down.

©
Tobias Hübner