Thursday, 27 August 2015

Difference between Sun JDK And Oracle JRockit

This is very important to know, which jdk is better than and which one to use.

Below are some basic difference between Sun JDK and Oracle JRockit.

As we know, JVM is responsible to convert  java byte code into machine code.

Sun jdk and Oracle JRockit do the same thing using different mechanism.

Sun JDK uses interpreter  – In this mechanism, the byte code is read and the translated into machine language, but these results are not saved in the memory. So every time even if the same method is run again and again, the JVM has to translate the code into machine language. This means machine code will not be reusable as it is not saved anywhere in the memory.  

Oracle JRockit uses only JIT compiler (Just In Time) – JIT mechanism means, once a method is run, the byte code is translated to machine language and this is saved in the memory. This means if the method is run again, there is no need for translation and the machine code is reused.

In the long run processes, JRockit gives a slightly better performance as compared to sun jdk.

Memory spaces in jdks:
 
Sun JDK has the following memory spaces:
  1.  Eden space
  2.  Survivior space
  3.  Tenured generation 
  4.  Permanent generation

 The objects move from one space to another according to its age and survival from garbage collection.

JRockit has 2 spaces
  1. Young generation 
  2.  Old generation
It uses the same mechanism of garbage collection. There is nothing called as permanent generation in JRockit.



Memory and other JVM tunings:

JRockit gives advanced JVM tunings. From the release R26 and above, JRockit takes care of few tunings by itself. For example if there is an outofmemory occuring on the native TLA in previous releases due to insufficient TLA size which is 2k by default, in later releases the JRockit tunes these settings as per the requirement of the application. This has to be done and taken care of by the user in case of sun jdk. But then it is always better to be in a safer side it is recommended to have the tunings done by self.

Which one should we use?

It definitely depends on the application you want to run. Here is a summary of when to use them:

Sun JDK

  • Desktop application
  • UI (swing) based application
  • Desktop daemon
  • Fast starting JVM

JRockit

  • Java application server
  • High performance application
  • Need of a full monitoring environment

No comments:

Post a Comment