Differences between JVM client mode and Server Mode

Source: Internet
Author: User

Here we will describe it to you.JVMThe Difference and connection between client mode and server mode. If the JVM does not explicitly specify-server mode or-client mode, JVM can automatically judge based on the following principles (applicable to Java 5 or later ).

JVM client mode and Server Mode

The main difference between JVM server mode and client mode is that-server mode starts slowly, but the performance will be greatly improved once it starts up. If the JVM does not explicitly specify the-server mode or-client mode, the JVM can automatically determine based on the following principles (applicable to Java 5 or later ).

Some time ago, a colleague sent me a performance comparison between Java and C ++.Article, A comparison chart aroused my interest. unexpectedly, I am not interested in comparing Java and C ++, it is a comparison between the Java-server mode and the Java-client mode. I never imagined that there was such a huge difference in performance between the two. However, I found this was true in my own tests.

The comparison chart I see is as follows:

The most significant difference in the figure is the comparison between the JVM client mode and the server mode about method call. The difference is not very big. In subsequent tests, we found that the difference is at least 10 times.

The following are two comparison figures:

JVM works in server mode to greatly improve performance, but application startup is about 10% slower than client mode. When this parameter is not specified, the VM starts to check whether the host is a server. If yes, the VM starts in server mode. Otherwise, the VM starts in client mode, j2se5.0 detects at least two CPUs and a minimum of 2 GB memory.

When JVM is used to start interactive applications on the GUI interface, it is applicable to the client mode. When JVM is used to run the server backgroundProgramServer mode is recommended.
The default value of JVM in client mode is-XMS is 1 m,-xmx is 64 m, JVM is 128 m by default in server mode, and-xmx is 1024 M. Run Java-version to check the default mode in which JVM works.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.