Question

I cannot find any clear documentation about the exact effect of passing the -server option when launching a sun HotSpot JVM.

Can anybody sum-up what it does?

Was it helpful?

Solution

With -server the JVM will compile hotspots (i.e. parts of the code that are often executed) more aggressively, and as a consequence the compiler will take more time to do so. This is not a problem since you only use this option when your processes run for extended periods of time (e.g. on a server).

When using -client, the optimizations that are done are much lighter and quicker, because you don't want long pauzes when the compiler kicks in when running a client app.

OTHER TIPS

I seem to recall reading that it does more work up front so that long-running programs perform better but at the expense of slower startup.

Also see: What's the difference between the -client and -server systems?

On some platforms the -server flag is set by default.

i.e. if its Linux/Solaris and has more than 2GB memory and more than 2 processors. As you can tell - those requirements were defined a long time ago. I have laptops better specified than that now...!

I am guessing they never set it as a default on Windows because they assumed that Windows would only run client java and *nix would run server java.

Until recently we ran our long running server processes on Windows Server and turning the flag made a noticeable difference.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top