What's the effect of -server option for the HotSpot JVM?

时光毁灭记忆、已成空白 提交于 2019-12-08 12:02:09

问题


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?


回答1:


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.




回答2:


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?




回答3:


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.



来源:https://stackoverflow.com/questions/1459548/whats-the-effect-of-server-option-for-the-hotspot-jvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!