Rich
Rich

Reputation: 15757

Java VM tuning - Xbatch and -Xcomp

I am looking at the JVM configuration options for running Alfresco, mainly this document on the Alfresco Wiki. One of the recommendations is to use the JVM flags -Xcomp and -Xbatch. The justification of this is:

If you wish to have Hotspot precompile the classes, you can add [-Xcomp and -Xbatch]. This will, however, significantly increase the server startup time, but will highlight missing dependencies that can be hit later.

From what I have read elsewhere about the -Xcomp and -Xbatch flags, I am wondering whether they really provide any benefit.

Does anyone have any thoughts? My inclination is to get rid of these two flags and rely on the VM to get things right.

I would like to add two things, first of all that I don't yet have access to an Alfresco instance to test this on and secondly I don't really know what spec of machine is hosting Alfresco other than that by looking at the other configuration options it must be a 64 bit VM. Despite this, I hope the community will have some useful input, perhaps from a general HotSpot-tuning point of view.

Upvotes: 36

Views: 12797

Answers (2)

fglez
fglez

Reputation: 8552

Generally speaking, it's always preferable to let HotSpot compiler tune itself. Even using Server VM (-server) is default for 64bits and some 'server-class' machines.

-Xbatch was intended mostly for debugging as described in Steve Goldman's blog you pointed:

So the -Xbatch switch is not a particularly useful switch even in the pre-mustang days. It is somewhat useful for jvm developers since it tends to make a run more predictable and reproducible.

-Xcomp removes the ability to gather information for efficient compilation. From an Alex Turner's post:

One might think that -Xcomp would be a good idea from a performance point of view. However, it is not! The JIT compiler uses those 1000 iterations before compilation to gather information on how the method should be compiled for optimal efficiency. -Xcomp removes its ability to do so and thus we can actually see performance slip.

Without performance in mind, I've never seen using those flags to detect missing dependencies (and it may not work if some code is still interpreted) so IMHO, I would get rid of both.

Upvotes: 30

Jayan
Jayan

Reputation: 18459

Alfresco is an Enterprise Content Management. I am not sure how the flags affects its performance. Then a note in the same page said..

-- This will, however, significantly increase the server startup time, but will highlight missing dependencies that can be hit later. ...

IMHO, The author did not really mean a performance gain. He/she wrote it as means to check all dependencies are in place.

Upvotes: 0

Related Questions