Friday, March 13, 2015

Oracle SOA JVM settings

Upgrading the JVM to the latest version is often required for tuning the performance or upgrading the products like SOA from 11g to 12c which requires higher version of JVM.Even though latest versions have top performance it might not be certified with the product for support. By having proper back of the files we can always fall back to the certified JVM version and reproduce the issue and work with support in case latest versions are not certified. These steps are applicable while starting the servers using the node manager from the admin console.


Upgrading JRockit for SOA


Below are the steps required to upgrade JRockit to a newer version which in our case will be from JRockit R28.2.5 to JRockit R28.3.5.All Java SE Downloads are available on MOS (Doc ID 1439822.1).Since we dont want to replace the java version of the system we have downloaded  and extracted the file to a location with write access(for example /u05/java/jrockit-jdk1.6.0_91).Navigate to the bin folder and run ./java -version to find the version of the newly installed JVM.


  • Navigate to $DOMAIN_HOME/bin folder and edit the setDomainEnv.sh file and set the new java home for the variable BEA_JAVA_HOME.
  • Another file that needs is commEnv.sh in the $WL_HOME/common/bin location.
  • If required change the nodemanager.properties file located at  $WL_HOME/common/nodemanager.



Confirm the changes have taken effect from the node manager and the server logs as below.







Switching the JVM from JRockit to HotSpot


Since JRockit is getting converged with HotSpot as HotRockit and no more update on JRockit after JDK 6 we can also look into options like switching the JVM from one vendor to the other and below are the steps required to switch from JRockit to HotSpot. In that case below are the steps that need to be followed.

Download the latest JRE from Doc ID 1439822.1 and upload the tar to the location where it needs to be installed and run the below command to extract and install.

gzip -dc server-jre-8uversion-solaris-sparcv9.tar.gz | tar xf -


Edit the file commEnv.sh in the $WL_HOME/common/bin location. The varaible JAVA_VENDOR needs to be set to Sun and JAVA_HOME needs to point to the new java home.It is very important to set the Java vendor since there will be many parameters set based on the vendor type.




Navigate to $DOMAIN_HOME/bin folder and edit the setDomainEnv.sh file and set the new java home for the variable SUN_JAVA_HOME.




Also if there are any VM specific parameters that are set as arguments along with memory arguments  that will need to be removed.For example parameter -Xgcprio:pausetime is specific to JRockit.

Make sure from the server logs the JVM has been changed.




Setting Specific memory in SOA domain


Usually there will be many managed servers running in the SOA domain and it will be required to set specific JVM size for each of the servers. This can be achieved by changing the setSOADomainEnv.sh in the $DOMAIN_HOME/bin location as below. 

if [ "${SERVER_NAME}" = "wls_soa1" ] || [ "${SERVER_NAME}" = "wls_soa2" ]; then
  DEFAULT_MEM_ARGS="-Xms1536m -Xmx1536m"
  PORT_MEM_ARGS="-Xms4096m -Xmx4096m"

elif [ "${SERVER_NAME}" = "" ] || [ "${SERVER_NAME}" = "AdminServer" ]; then
  DEFAULT_MEM_ARGS="-Xms1536m -Xmx1536m"
  PORT_MEM_ARGS="-Xms1536m -Xmx1536m"

elif [ "${SERVER_NAME}" = "wls_osb1" ] || [ "${SERVER_NAME}" = "wls_osb2" ]; then
  DEFAULT_MEM_ARGS="-Xms1536m -Xmx1536m"
  PORT_MEM_ARGS="-Xms1536m -Xmx1536m"

elif [ "${SERVER_NAME}" = "wls_wsm1" ] || [ "${SERVER_NAME}" = "wls_wsm2" ]; then
  DEFAULT_MEM_ARGS="-Xms768m -Xmx768m"
  PORT_MEM_ARGS="-Xms768m -Xmx768m"

else
  DEFAULT_MEM_ARGS="-Xms768m -Xmx768m"
  PORT_MEM_ARGS="-Xms768m -Xmx768m"

fi


This can be useful to set specific port for the servers when monitoring the JVM remotely from tools like java mission control.

But setting a larger heap size always is not a good idea for many reasons and a capacity planning needs to be done before changing these values.For better performance there should be a 50 percent free heap space for the process to run.The free heap space can be monitored using tools like Java mission control locally or remotely which should come below 50 percent on full garbage collection. Below is a sample screen shot.





Any customization to the above mentioned files will be overridden if the configuration wizard is run again and will need to be reconfigured. As a option these customizations can be maintained in a different file (say setCustomEnv.sh) and included in setDomainEnv.sh file so that not impacted by any upgrade and can be added back.