the java native mode

Dear all,

From time to time , we can see that the java mode we are using is x64 mixed mode and what is the benefit of changing from mixed mode to native mode?


 how to change it please ?
LVL 1
marrowyungSenior Technical architecture (Data)Asked:
Who is Participating?

Improve company productivity with a Business Account.Sign Up

x
 
Gary PattersonConnect With a Mentor VP Technology / Senior Consultant Commented:
so the final verions is:

"D:\Program Files\Java\jre7\bin\javaw.exe" -cp jts.jar;total.2012.jar -Xcomp -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx768M -XX:MaxPermSize=128M jclient/LoginFrame

yes

I will run mulit threading java financial application, what will be the benefit of using Native mode

Performance will probably be worse in this kind of application in native mode.  You should run in mixed mode.  That is why mixed mode is the default - it provides the best performance for most applications.

What is the mixed mode, compiled mode and interpreted mode ?


Read the article I posted the link to.  I think it answers all these questions pretty clearly.
0
 
marrowyungSenior Technical architecture (Data)Author Commented:
on this sense, the application already running the java run time, like javaw.exe should be able to take advantage on it.

Any parameter for javaw.exe to change to take advantage on the native mode?

e.g.:

"D:\Program Files\Java\jre7\bin\javaw.exe" -cp jts.jar;total.2012.jar -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx768M -XX:MaxPermSize=128M jclient/LoginFrame 

Open in new window


?
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
You can force the JVM into native mode with the -Xcomp flag, but performance will frequently suffer.  

-Xcomp revents ANY code from running interpreted - even if it only runs once and running interpreted would be faster than compiling it.  Still, there are cases where a particular application may benefit from -Xcomp.  

No harm in testing it.

Just be aware that if the runtime characteristics of your application change, the JVM won't be able to adapt and make an intelligent decision if you are not running in mixed mode.  

https://blog.codecentric.de/en/2012/07/useful-jvm-flags-part-1-jvm-types-and-compiler-modes/
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
Amitkumar PSr. ConsultantCommented:
Agree with Gary. For more information refer the link provided by him.
0
 
marrowyungSenior Technical architecture (Data)Author Commented:
"You can force the JVM into native mode with the -Xcomp flag, but performance will frequently suffer.  "

you mean thing in my command need to remove  and add this one ?

so the final verions is:

"D:\Program Files\Java\jre7\bin\javaw.exe" -cp jts.jar;total.2012.jar -Xcomp -Dsun.java2d.noddraw=true -Dswing.boldMetal=false -Dsun.locale.formatasdefault=true -Xmx768M -XX:MaxPermSize=128M jclient/LoginFrame

?

I will run mulit threading java financial application, what will be the benefit of using Native mode ?
0
 
marrowyungSenior Technical architecture (Data)Author Commented:
What is the mixed mode, compiled mode and interpreted mode ?
0
 
marrowyungSenior Technical architecture (Data)Author Commented:
That option will only slow down that appliation after test on 2 x PC I have, one icore 7 3rd edition and one Xeon E-xxxx.

Both slower than mixed mode,

"Performance will probably be worse in this kind of application in native mode. "

why is it ?
0
 
marrowyungSenior Technical architecture (Data)Author Commented:
"Read the article I posted the link to.  I think it answers all these questions pretty clearly. "

I don't think that article tells clearly, sorry about that.
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
OK, let's take this one bit at a time.  There are three modes:

1) Interpreted mode:  All bytecode is interpreted.

2) Native mode: All bytecode is compiled before it is executed.

3) Mixed mode:  JIT compiler can elect to interpret some code, and compile some code.  It takes time to compile code, so if a chunk of code is only used once, it may be faster to just interpret it.

Do you have any questions about that part?
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
That option will only slow down that appliation after test on 2 x PC I have, one icore 7 3rd edition and one Xeon E-xxxx.


I don't understand what you mean.

Both slower than mixed mode,

Yes, I would expect both interpreted and native mode to be slower than mixed mode for most applications.  Is that what happened when you tested?

Do you have a question?
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
"Performance will probably be worse in this kind of application in native mode. "

why is it ?


Because mixed mode lets the JIT compiler optimize runtime by deciding to interpret or compile on a case-by-case basis, depending on what it determines may be faster.

It takes time to compile, so for code that doesn't get executed frequently, it can be faster to just interpret it than to compile and then execute the compiled code.
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
I don't think that article tells clearly, sorry about that.

OK, so now that you've read the article, do you have any specific questions about it that I can help you understand?  I don't know what your background is.  I don't know if you know what "interpreted" vs "compiled" means.  I don't know if you understand JIT compilation - unless you ask more specific questions.  

Just saying "I don't understand" makes it hard to figure out what needs to be explained.

This isn't a very complicated topic - there are only three options:  

1) For code that gets executed repeatedly in a loop, compiling the code once and then executing the compiled code repeatedly is generally faster than interpreting it.

2) For code that is not executed repeatedly in a loop, interpreted mode is generally faster than compiling and then executing.

3) But since most applications have both kids of code - mixed-mode usually performs the best, and that is why it is the default.

Here is a good basic description of mixed-mode from Sun:

http://docs.oracle.com/cd/E19455-01/806-1367/ch2features-23/index.html
0
 
marrowyungSenior Technical architecture (Data)Author Commented:
"That option will only slow down that appliation after test on 2 x PC I have, one icore 7 3rd edition and one Xeon E-xxxx."

I mean it is not hardware performance problem.

"Yes, I would expect both interpreted and native mode to be slower than mixed mode for most applications.  Is that what happened when you tested?"

I only text mixed mode and native mode.

"
It takes time to compile, so for code that doesn't get executed frequently, it can be faster to just interpret it than to compile and then execute the compiled code. "

right now here, interpret means it still not complied it but why interpret ? it has to complite before it use, right?

"OK, so now that you've read the article, do you have any specific questions about it that I can help you understand?  I don't know what your background is.  I don't know if you know what "interpreted" vs "compiled" means. "

exactly ! I don't know, I am not a developer ! thanks for coaching me a lot !

"2) For code that is not executed repeatedly in a loop, interpreted mode is generally faster than compiling and then executing.

you are developer !?

"3) But since most applications have both kids of code - mixed-mode usually performs the best, and that is why it is the default."

get it !! I think and believe.
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
right now here, interpret means it still not complied it but why interpret ? it has to complile before it use, right?

No.  Java is an interpreted language.  Sometimes we use the term "compile" when we use javac - but that's really just conversion from human-readable Java to more compact Java bytecode.

Compiled languages have to be compiled separately for each hardware platform and OS that they run on.  Interpreted languages are executed dynamically in a special runtime environment (JRE for Java, php for php) that understands how to execute each line of code as it is encountered at runtime.

Compiled languages tend to be fast, but less portable.

Interpreted languages tend to run slower, but are more portable.

To speed Java up, a feature called "just-in-time compilation" was created (JIT) which helps speed Java up by compiling certain methods to native machine language at runtime.  This speeds up execution of methods that are executed many times.  But this compilation process happens every time a program is run., unlike true compiled languages.

you are developer !?

Yes.  I've been a professional programmer since 1988.
0
 
marrowyungSenior Technical architecture (Data)Author Commented:
"To speed Java up, a feature called "just-in-time compilation" was created (JIT) which helps speed Java up by compiling certain methods to native machine language at runtime.  This speeds up execution of methods that are executed many times.  But this compilation process happens every time a program is run., unlike true compiled languages."

ok, mixed mode is the fastest anyway !!

you know oracle ? you know Oracle procedure, package and function programming ?
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
My primary database platform is DB2 on IBM i, but I am also familiar with Oracle.
0
 
marrowyungSenior Technical architecture (Data)Author Commented:
good! DB2 is good ?

right now we have a project to migrate DB2 V8.1 to MS SQL, our DB2 8.1 is very bad that the memory configuration has to be tune manually.

Recently that I think there are some kind of hardwre failure as ONLY some times that the application keep prompting errors and later on we reboot it, it is ok ! the error is heap memory problem !

Then we found that we have no choice to recalculate the memory usage ourselves, what ? the DB is not going to handle it automatically !!

but I heard that since DB V9, it will be much better !

Now I have the task of Oracle data auditing that need to build trigger as we need data level trigger instead of action level.

I have done the MySQL one and I am happy with this, this involve a lot of dynamically, package, function programming, hope you keep helping me on this!

thanks.
0
 
Gary PattersonVP Technology / Senior Consultant Commented:
Upgrading DB2 is a lot easier than migrating.
0
 
marrowyungSenior Technical architecture (Data)Author Commented:
Ahah. We will have a the last application as a fresh install on top of the MS SQL server, then use the export feature of the application to export all data to the CSV file and the reimport from the new version !
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.