Use the following command which gives the process size.
ps auxwww | grep java
Process size - Max size is 3 Gb on unix and 4 gb on solaris
[process size includes stacks,native code,therads created etc]
user 6451 180 30.2 [1416444-->process_size] 626888 ?
A check on the process size is critical because when there are leaks this gradually increases and finally the server crashes.
Command to get the Memory Details
jmap -dump:live,format=b,file=histo.bin
Command to generate Report Using JHat
jhat -J-mx256m histo.bin [histo.bin can be pscp'ed to windows machine and this command can be executed]
This starts a server gives a port number at the command line. using this url the details can be viewed through a explorer
Consequently the following command can be used to get the current memory picture in the JVM.
jmap -histo:live [process-id] > [filename].txt
The following command is also useful to understand the java heap and the GC behavior
jstat -gcutil 2361 1s
UseFull Vm parametres
-XX:+HeapDumpOnOutOfMemoryError
-XX:+PrintGCTimeStamps
-XX:+PrintGCDetails
-XX:+PrintGCApplicationStoppedTime
-verbose:gc
-XX:ErrorFile=/location/error.log
-XX:HeapDumpPath=/location/heap_dump.hprof
jstack [process_id] or kill -3 [process_id] can be used to get the thread dump of the process.
Friday, October 23, 2009
Java Monitoring Guidelines
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment