Java - Client and Server VM
Home Java Java PerformanceThe java virtual machine can be started in two modes.
- client - Typically used for desktop application. The java is started with -client option
- server - Typically used for server application which are not interactive in nature. The java is started with -server option
Let's write simple HelloWorld class and run it with two options:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}Now run the code with java option
- java -client -verbose
[Loaded java.lang.Object from shared objects file] [Loaded java.io.Serializable from shared objects file] [Loaded java.lang.Comparable from shared objects file] [Loaded java.lang.CharSequence from shared objects file] [Loaded java.lang.String from shared objects file] .... [Loaded java.security.BasicPermissionCollection from shared objects file] [Loaded java.security.Principal from shared objects file] [Loaded java.security.cert.Certificate from shared objects file] [Loaded HelloWorld from file:/home/lalit/Data/crayom/training/Performance/eclipseCode/HelloWorld/bin/] Hello World [Loaded java.lang.Shutdown from shared objects file] [Loaded java.lang.Shutdown$Lock from shared objects file]
With server option
- java -server -verbose
[Opened /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar] [Loaded java.lang.Object from /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar] [Loaded java.io.Serializable from /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar] [Loaded java.lang.Comparable from /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar] [Loaded java.lang.CharSequence from /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar] [Loaded java.lang.String from /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar] ... [Loaded java.security.BasicPermissionCollection from /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar] [Loaded java.security.Principal from /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar] [Loaded java.security.cert.Certificate from /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar] [Loaded HelloWorld from file:/home/lalit/Data/crayom/training/Performance/eclipseCode/HelloWorld/bin/] Hello World [Loaded java.lang.Shutdown from /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar] [Loaded java.lang.Shutdown$Lock from /usr/lib/jvm/java-6-sun-1.6.0.16/jre/lib/rt.jar]
It's quite a verbose output, however for clarity most of the output is removed. The only noticeable difference here is the location from where the objects are loaded. The client and server vm both use the same code base. However the client VM is designed for fast load up time and small foorprint. On the other hand, server VM is designed maximum performance speed and involves adaptive optimization techniques not present in client VM. Also server VM are tuned to run for longer durations.
Starting from Java 5 the definition of server machine is:
- >=2 Physical processors
- >= 2GB of physical memory
The detail classification of server and client machine can be accessed at here
The VM by default runs in the server or client mode based on the machine classification. However the setting can be changed by providing the switches specifically while starting java.
Home Java Java Performance
Sidebar
Last wiki comments
- Introduction to ORM: ugg boots
- Introduction to ORM: ugg boots
- AOP: Thanks
- Lalit Bhatt: Superb Collection
- Lalit Bhatt: J2EE training
- Introduction to ORM: timberland shoes
- Introduction to ORM: jordan shoes
- Introduction to ORM: nike air max
- Pune Tourist Spots: KONARK PARK CLOSED
- jQuery Form Validations: Jquery Developer
Sidebar
Random Pages
- What markets work on?
- Why projects fail?
- Bharat Band - Jai ho
- The concept of Nation
- Don't hide complexity if it cannot be handled in a robustway
Last blog post comments
-
Prospective MLA for Pune election - 2009: ugg boots
Wed 01 of Sep., 2010 12:58 IST
-
Bharat Band - Jai ho: How do we protest?
Wed 18 of Aug., 2010 13:13 IST
-
Divided by Destiny: Contact
Fri 23 of July, 2010 16:02 IST
-
Future of Java: thesis writing
Sat 17 of July, 2010 01:50 IST
-
Hang till Death Mr. Kasab: some change
Mon 28 of June, 2010 16:03 IST
-
God Religion : Why we are confused?: Re: Is GOD Necessary?
Tue 15 of June, 2010 17:29 IST
-
God Religion : Why we are confused?: Is GOD Necessary?
Tue 15 of June, 2010 13:06 IST
-
The reason in religion: good
Wed 10 of Mar., 2010 18:30 IST
-
The confusion of Design Patterns: I think at macro level you are right...
Tue 23 of Feb., 2010 03:31 IST
-
The Indian Municipality: Comment
Fri 22 of Jan., 2010 13:20 IST
Post new comment