4

I am benchmarking a JVM application which puts very heavy load on both disk IO and CPU.

Normally I benchmark it using 4G max/min heap size, the whole benchmark suit takes in average 73 seconds to run.

Today I was curious and gave it only 1G max/min heap size, and surprisingly the whole benchmark suit takes only 62 seconds to run in average.

So I wonder why does JVM perform better with a smaller heap size?

Extra notes:

Environment:

java version "1.7.0_19"
OpenJDK Runtime Environment (fedora-2.3.9.1.fc17-x86_64)
OpenJDK 64-Bit Server VM (build 23.7-b01, mixed mode)

Linux ____ 3.8.4-102.fc17.x86_64 #1 SMP Sun Mar 24 13:09:09 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

1 Answer 1

3

From the docs on Oracle JVM, the note says

Next, you might try decreasing the amount of heap used. A larger heap will cause garbage collection pauses to increase because there is more heap to scan.

It is also function of GC algorithm you use. For example incremental GC may give completely different numbers. (Try -Xincgc and see your numbers)

link

Sign up to request clarification or add additional context in comments.

2 Comments

thank you for that, my apologize that I did not mention my JVM environment. Does OpenJDK have similar behaviour?
@ Howard Guo - It is really function of JRE not JDK. I expect Oracle and OpenJDK to have similar behavior here. GC etc share same code.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.