Roger Johansson
Roger Johansson

Reputation: 23214

JVM Performance tuning

I am struggling to understand why some things affect performance in unexpected ways on the JVM. More specifically, I have a micro benchmark which checks how fast my actor framework can send messages in a ping-pong fashion.

The framework has a registry of actors, and this registry is partitioned. The benchmark doesn't really touch this code more than on startup. So there is no hot path what so ever in here. Still. depending on how many partitions the registry has, the app runs slower or faster.

A higher number of partitions, the faster the app runs, up to a certain point that is.

Just to be super clear, that code is not touched in the actual profiling bit of the benchmark. it's just there, hogging memory.

The only plausible reason I can think of is the GC being affected in some way with large objects, but as it runs faster the more partitions the registry has, this feels counter intuitive.

This happens both with and without JVM GC parameters.

So, any ideas? Are there some obvious things that I should know about? e.g. that large objects have some over all effect on the GC or something similar?

Java version 1.8.0_131

Upvotes: 2

Views: 646

Answers (2)

Kire Haglin
Kire Haglin

Reputation: 7069

You could do a Flight Recording and look at it in Java Mission Control. It will give you information about GC activities, lock contention, allocation rate, I/O, memory usage, long running safepoint operation that happen inside VM etc.

Upvotes: 0

ACV
ACV

Reputation: 10562

You can start with these:

Garbage-First Garbage Collector Tuning

Java Platform, Standard Edition HotSpot Virtual Machine Garbage Collection Tuning Guide

But if you want more concrete solutions, provide some source code and point precisely where the problem is and what the measurements are. What pattern are you observing.

Also, you can use VisualVM and Mission Control - standard tools in JDK.

By the way, as you are asking about actors, I think this could be interesintg (there is an example at the bottom about Akka):

Tuning the JVM for low pauses garbage collectors CMS and G1 (Scroll down to find Akka)

Upvotes: 1

Related Questions