Real differences between “java -server” and “java -client”?

前端 未结 11 2101
旧时难觅i
旧时难觅i 2020-11-22 03:52

Is there any real practical difference between \"java -server\" and \"java -client\"?

All I can find on Sun\'s site is a vague

\"-server st

11条回答
  •  北恋
    北恋 (楼主)
    2020-11-22 04:45

    Last time I had a look at this, (and admittedly it was a while back) the biggest difference I noticed was in the garbage collection.

    IIRC:

    • The server heap VM has a differnt number of generations than the Client VM, and a different garbage collection algorithm. This may not be true anymore
    • The server VM will allocate memory and not release it to the OS
    • The server VM will use more sophisticated optimisation algorithms, and hence have bigger time and memory requirements for optimisation

    If you can compare two java VMs, one client, one server using the jvisualvm tool, you should see a difference in the frequency and effect of the garbage collection, as well as in the number of generations.

    I had a pair of screenshots that showed the difference really well, but I can't reproduce as I have a 64 bit JVM which only implements the server VM. (And I can't be bothered to download and wrangle the 32 bit version on my system as well.)

    This doesn't seem to be the case anymore, having tried running some code on windows with both server and client VMs, I seem to get the same generation model for both...

提交回复
热议问题