Solved

Flavors of JVM

Posted on 2014-03-25
4
368 Views
Last Modified: 2014-04-24
Hi,

I read there are two flavors of JVM one is client mode and other is server mode.

I would like to know advantages, disadvantage, practical uses of each of them.

please advise
Any links resources ideas highly appreciated. Thanks in advance
0
Comment
Question by:gudii9
  • 2
  • 2
4 Comments
 
LVL 35

Expert Comment

by:mccarl
ID: 39954789
one is client mode and other is server mode
Essentially, the difference between the two is in how your code gets optimized. Optimization can occur in different ways, in order to maximise different things.

client mode assumes that the application is something that an actual user is running and interacting with as so it will optimize for the fastest possible response time, ie. get something in front of the users face as quick as possible, this might be at the expense of a slower total time to process (or whatever the app is doing). This is useful as generally a human will perceive this faster response time as better overall performance, even if it does take a little longer.

server mode assumes that the application is something that might be sitting in the background, maybe doing something like a batch job, etc. For this, response time means little and so the code will be optimized for the best overall total time to process. For example, it may take a little bit longer to start the application, so that it can get everything set up so that the actually batch run completes in the fastest total time.


http://www.oracle.com/technetwork/java/hotspotfaq-138619.html#compiler_types


One thing that I would add though, in most real world applications, I highly doubt that you would see much difference at all between the two.
0
 
LVL 7

Author Comment

by:gudii9
ID: 40005301
how do i know which mode my jvm is running. How  to switch from one mode to other mode on my laptop jvm. please advise
0
 
LVL 35

Accepted Solution

by:
mccarl earned 500 total points
ID: 40005618
how do i know which mode my jvm is running
Well, the link that I provided in my first post should have given you some pretty good hints but to make it explicit... If you are on 32-bit windows and have only installed the JRE (not the JDK) then you only have the "client" mode available to you. For other cases, it is not quite as clear, but you can find out what mode is used by default in YOUR environment, by just running "java -version". In the resulting output, you will see something like "Java HotSpot(TM) Client VM ....." or "Java HotSpot(TM) Server VM .....", from which you can see what your default is.

How  to switch from one mode to other mode on my laptop jvm.
That JVM doesn't always run in one mode or the other, you can tell it which mode to start in when you start the JVM by specifying command line options. eg, if you use the following command line... "java -server -cp ..... MyMainClass" it will run your MyMainClass class using the Server VM. There is also a "-client" command line option to force the Client VM.

If you are talking about something that has a more advanced method of starting, ie. Eclipse is just started from an icon on your desktop, then these applications using have .ini files (or some other way to configure their startup) in which you can ususally specify command line options to be used when starting. It is here where you would use either -client or -server.

Also, see this link for some more reference information...
http://docs.oracle.com/javase/7/docs/technotes/guides/vm/
0
 
LVL 7

Author Comment

by:gudii9
ID: 40006909
If you are on 32-bit windows and have only installed the JRE (not the JDK) then you only have the "client" mode available to you.

how about 64 bit windows like my laptop. There also if only JRE isntalled mode is only 'client'
Please advise

I ran
java -version

i see server mode like below
Java HotSpot(TM) 64-Bit Server VM (build 20.6-b01, mixed mode)

what is build and what is mixed mode as it showed.
0

Featured Post

Master Your Team's Linux and Cloud Stack

Come see why top tech companies like Mailchimp and Media Temple use Linux Academy to build their employee training programs.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Java - Why doesn't this JFrame work 3 59
eclipse argument 14 61
xampp tool 12 51
maven module vs maven project 3 23
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

803 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question