For suggestions on how to gather GC data and analyze it, see these white papers:
Java Garbage Collection Statistical Analysis 101
Java Garbage Collection Performance Analysis 201
I have a jboss 5.1 app with sun jdk 1.7.something. At night, it runs a large job and gobbles memory. The process gets to 2.5GB and never goes down, but I hear that's normal with heap space? But after a few days of this, I begin to see the cpu spike to 100% of one cpu for a few seconds, then go down. This happens every 5 seconds or so, probably GC?
Using mostly a default run.bat, I have the jvm args set to:
-Xrs -Xms256M -Xmx2048M -XX:MaxPermSize=256m -XX:+CMSClassUnloadingEnabled -XX:+UseConcMarkSweepGC
Should we be doing something more specific? And if the GC keeps running that often even after the thread to do the nightly job has ended, do I have a memory leak somewhere? We do sometimes run out of memory, but maybe it needs Xmx of 4gb just to finish the job.
I'm going to up the memory anyway, but what clues do we look for to determine if there is a leak and/or better GC settings?
Thank you very much!
You can try adding below JAVA options in your "run.bat" to analyse what's wrong with GC :
-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps
-Xloggc:<location of log directory>\gc.log
"gc.log" will contain the information about the collections, if you see a lot of gc activity (mostly FULL GC) when the issue occurs, then you would need to tune your memory/gc settings.