Trying to monitor jvm for out of memory errors
I'm looking to figure out an easy way to monitor a java process to see when heap usage gets over a certain threshold of the total max heap. This is how I've started my java process (jira) and jmap shows current stats. Ideally I'd like to be able to query and find out when I'm around 1.8gb of max heap (out of 2gb total). It looks like the percentages used change depending upon how much is allocated. I would also expect to see at least something around 1gb since that's what I set the initial heap size to.
Can anyone give me any pointers? I've only just started playing with this stuff (jvm monitoring).
[jira@jiraserver bin]$ ps -ef | grep java
jira 23497 6289 0 12:50 pts/3 00:00:00 grep java
jira 30317 1 0 Aug05 ? 00:08:12 /apps/software/java/jdk1.6.0_20//bin/java -Djava.util.logging.config.file=/apps/software/tomcat/jira/current/conf/logging.properties -XX:MaxPermSize=256m -Xms1024m -Xmx2048m -Djava.awt.headless=true -Datlassian.standalone=JIRA -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_B UFFER=true -Dmail.mime.decodeparameters=true -Djira.jelly.on=true -Djira.home=/apps/software/tomcat/jira/jirahome -Djava.util.logging.manager=org.apache.juli.ClassLo aderLogManager -Djava.endorsed.dirs=/apps/software/tomcat/jira/current/endorsed -classpath /apps/software/tomcat/jira/current/bin/bootstrap.jar -Dcatalina.base=/apps/software/tomcat/jira/current -Dcatalina.home=/apps/software/tomcat/jira/current -Djava.io.tmpdir=/apps/software/tomcat/jira/current/temp org.apache.catalina.startup.Bootstrap start
[jira@jiraserver bin]$ ./jmap -heap 30317
Attaching to process ID 30317, please wait...
Debugger attached successfully.
Server compiler detected.
JVM version is 16.3-b01
using thread-local object allocation.
Parallel GC with 8 thread(s)
MinHeapFreeRatio = 40
MaxHeapFreeRatio = 70
MaxHeapSize = 2147483648 (2048.0MB)
NewSize = 5439488 (5.1875MB)
MaxNewSize = 17592186044415 MB
OldSize = 5439488 (5.1875MB)
NewRatio = 2
SurvivorRatio = 8
PermSize = 21757952 (20.75MB)
MaxPermSize = 268435456 (256.0MB)
PS Young Generation
capacity = 349503488 (333.3125MB)
used = 338399616 (322.7230224609375MB)
free = 11103872 (10.5894775390625MB)
capacity = 4194304 (4.0MB)
used = 1480624 (1.4120330810546875MB)
free = 2713680 (2.5879669189453125MB)
capacity = 3932160 (3.75MB)
used = 0 (0.0MB)
free = 3932160 (3.75MB)
PS Old Generation
capacity = 715849728 (682.6875MB)
used = 419149776 (399.7323760986328MB)
free = 296699952 (282.9551239013672MB)
PS Perm Generation
capacity = 156434432 (149.1875MB)
used = 156432376 (149.18553924560547MB)
free = 2056 (0.00196075439453125MB)