summary about Java's two VM : Server & Client
--------------------------------------------------------------------from myself----------------------------------------------------------------------- Currently, only 64-bit supports server mode
Server VMs start up about 10% slower than client VMs.Runs at least 10 times faster than Client VM; Since the CPU, memory and hard disk of the server are more powerful than the client machine, after the program is deployed, it should be started in server mode to obtain better performance. JVM defaults to 1M in client mode and 64M for -Xmx. JVM defaults to 128M in Server mode and 1024M for -Xmx.
server:启动慢,编译更完全,编译器是自适应编译器,效率高,针对服务端应用优化,在服务器环境中最大化程序执行速度而设计。
client:快速启动,内存占用少,编译快,针对桌面应用程序优化,为在客户端环境中减少启动时间而优化; About GC: In the clien mode, the new generation chooses serial GC, and the old generation chooses serial GC In server mode, the new generation chooses parallel recycling GC, and the old generation chooses parallel GC Generally speaking, there are two ways to choose our system application: throughput priority and pause time priority, the default parallel GC mode of the server is used for the throughput priority, and the concurrent GC (CMS) mode is selected for the pause time priority.
--------------------------------------------------------------------from browser------------------------------------------------------------------------- JDK has two types of VMs, VM clients, VM server applications. The two solutions share the hotspot codebase of the Java runtime, but use different compilers for unique performance characteristics for both the client and server, and these differences include writing inline policies and heap defaults.
While servers and client VMs are similar, server VMs have been specifically tuned for maximum peak operating speeds. It is intended to execute long-running server applications that require the fastest running speed beyond a fast startup time or a small runtime memory footprint.
The Customer VM Compiler is a compiler used by classic virtual machines and real-time upgrades (JIT) through previous versions of the JDK. Client virtual machines provide improved performance for running applications and applets. Hotspot customers of Java Virtual Machines have been specially adjusted to reduce application startup time and memory footprint to make them particularly suitable for customer environments. In general, the client system has a better graphical user interface.
So the real difference is also at the compiler level:
The client virtual machine compiler does not attempt to perform more complex optimizations performed by the compiler on the server virtual machine, but during the exchange it takes less time to analyze and compile a piece of code. This means that client virtual machines can start faster and require a smaller memory footprint.
The server virtual machine contains an advanced adaptive compiler that supports many C++ compiler optimizations for optimization, the same type, as well as some optimizations that cannot be done with traditional compilers, such as aggressive inline in virtual method calls. It's a competitive and performance advantage, static compiler. Adaptive optimization techniques are very flexible in their approach and often outperform even advanced static analysis and compilation techniques.
When the -Server mode starts, the speed is slow, but once it is running, the performance will be greatly improved, because: when the virtual machine is in -Client mode, it uses a lightweight compiler codenamed C1, and the virtual machine started in -Server mode uses a compiler codenamed C2, which is relatively thoroughly compiled than the C1 compiler, and the performance is higher after service.
Generally, as long as you change the order of the two configurations of -server KNOWN and -client KNOWN,The premise is that both server and client folders exist in the /jre/bin directory of the JAVA_HOMEcorresponding to their respective JVMs
|