sundar

JVM - How to handle it in a better way to prevent app crashes

Discussion created by sundar on Oct 14, 2009
Gurus,

Just want to start an discussion about JVM (I know there are already many posts and we tried in many ways and now tired of not able to prevent application crashes),mainly how to set the proper JVM and hopefuly we will get some valuable inputs so that all clarity techies will be benefited.

I rate the JVM as the first and fore most performance Killer if it is not properly set. Our application suffered a lot ,we are using sun solaris 64 bit(i have set 3 Gig after monitoring the performance).
As iam still in Old 7.5.2 and using JRE 1.4.2.18 ,i used to check the memory by only this way.(Daily - Peak Period).

The memory usage for each Clarity application service can be viewed by navigating to:http://clarity_server[:server_port]/niku/app?action=security.caches

The entries 'Used Memory aaa of bbb (xx%)' and 'Total memory bbb of ccc (yy%)' at the top of this page should be read as follows:

aaa = Amount of JVM heap memory used by the Clarity cache
bbb = Amount of heap memory used by Clarity
ccc = Maximum amount of heap memory available to Clarity (the -Xmx JVM option)

when it is high,i will clear the cache memory and do the process again.

This page should be monitored at regular intervals during times of peak Clarity application service load, for example during Timesheet data entry on the last working day of the Time Period to establish what an appropriate maximum memory value should be.

Then in the sun solaris env i will use top,prstat,vmstat to check the usuage on peak hours.

Some thoughts:- (Read / heard).

Set the JVM Memory (Gurus will always tell it is an Art but won't reveal the secret) to a more meaningful way which is very difficult otherwise your application performance issues might be due to JVM.Set the appropriate Memory so that will release the memory to the operating system.It Depends upon your OS and whether it is 32 Bit or 64 Bit.Allways Check whether you are using Latest JRE version which your clarity version supports and upgrade.When you have an continous memory issues even after proper settings in the application pls have an look on Your J2EE server.  The maximum usable memory for a JVM on Windows, Solaris 2.6 and Solaris x86 platforms is approximately 1.5Gb this rises to approximately 3.5Gb on Solaris 7/8/9 (Sparc) 64 bit.Set the minimum (-Xms) and maximum (-Xmx) memory options to the same value.This value should not be greater than the physical memory installed on the server and should allow sufficient remaining memory for the running of the OS and other applications on the server.If 2 or more processors are available for each running Clarity service you should test whether the options '-XX:+UseParallelGC' and/or '-XX:+UseConcMarkSweepGC' ncrease throughput at peak times. For further information regarding these settings.Pls go through the URL   http://docs.sun.com/source/817-6088/jvm.html

You need to check when the memory usage goes up and if the garbage collection is doing it job.Note that these options have been superceded by internal improvements in the 1.5 Sun JVM.
If you want to check whether your memory is adequate or it is not enough you can set the following in NSA-->Application-->Java VM Parameters.

-Xms1536m â€"Xmx1536m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/niku/logs/heapdump.txt

I read that in clarity 8 and above as it uses java 1.5   and can use Jconsole / jvmstat to monitor our application performance.(If any body using pls share your experience).http://java.sun.com/developer/technicalArticles/J2SE/jconsole.html  And above all before making the memory change ,pls test it throughly because if you provide the JVM above the upper limit of the OS the app will not be up and you might be in trouble.  i have enclosed one java performance guide (not the latest).

Expecting more suggestions,thoughts,preventive measures too to stop application services down automatically (due to memory) so it will benefit all.

Cheers,
sundar

Attachments

Outcomes