views:

238

answers:

3

Hi all,

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?

+3  A: 

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?

Adrian Pronk
+2  A: 

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.

eljenso
You don't really get pauses because the compiler runs in a different thread. There is a delay between starting to compile the code and it being available. The Server HotSpot also defaults to waiting longer before it compiles (because the compile takes longer and uses more memory).
Tom Hawtin - tackline
A: 

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.

Fortyrunner