Solved

Flavors of JVM

Posted on 2014-03-25
4
395 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
web application structure 18 135
CSV file parsing thru Java 13 54
glassfish admin console 1 47
Hibernate Inheritance Strategy for Abstract Base class and two concrete classes 3 38
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
This tutorial explains how to use the VisualVM tool for the Java platform application. This video goes into detail on the Threads, Sampler, and Profiler tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

734 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