Solved

Flavors of JVM

Posted on 2014-03-25
4
374 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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet doXXX methods 3 62
How to convert String matching to regex in java 4 52
Is there a simpler dropbox system? 10 35
java mysql insert application 14 29
I had a project requirement for a displaying a user workbench .This workbench would consist multiple data grids .In each grid the user will be able to see a large number of data. These data grids should allow the user to 1. Sort 2. Export the …
Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
Viewers learn about the scanner class in this video and are introduced to receiving user input for their programs. Additionally, objects, conditional statements, and loops are used to help reinforce the concepts. Introduce Scanner class: Importing…
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:

821 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