Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between the Java Client VM and the Server VM? [duplicate]

Tags:

java

Possible Duplicate:
Real differences between "java -server" and "java -client"?

what are the technical differences between starting a java program with -server and with -client flag?

Thanks!

like image 312
clamp Avatar asked Nov 27 '25 10:11

clamp


2 Answers

from Frequently Asked Questions About the Java HotSpot VM :

These two systems are different binaries. They are essentially two different compilers (JITs)interfacing to the same runtime system. The client system is optimal for applications which need fast startup times or small footprints, the server system is optimal for applications where the overall performance is most important. In general the client system is better suited for interactive applications such as GUIs. Some of the other differences include the compilation policy,heap defaults, and inlining policy.

like image 136
Ashkan Aryan Avatar answered Nov 28 '25 22:11

Ashkan Aryan


One difference that I know of is related to JIT (Just In Time) compilation where JVM at runtime identifies hotspots in the code and based on that converts bytecodes into highly optimized native code.

With -client flag, the amount of JIT'ing performed is lesser than performed with -server flag. This is because clients are interactive apps that generally require low start-up times, and JIT'ing causes some start-up delays. You can read more about JIT here: http://en.wikipedia.org/wiki/Just-in-time_compilation

Also, I think (not very sure) that there would be some difference in Garbage Collection defaults selected with the change in these flags.

like image 26
peakit Avatar answered Nov 28 '25 23:11

peakit