Friday, May 16, 2014

How to Check Java Heap

Just some quick tips on checking the java heap.

You can get the process id from ps or use jps -l to list it.

jmap, jstat and jconsole are very good tools for finding out more about your jvm.

Check Heap size and details memory usage.
  • jmap -heap <jvm proc id> 
Check Max Settings
  • # ./jmap -heap 14272 |grep Max
    • Attaching to process ID 14272, please wait...Debugger attached successfully.Server compiler detected.JVM version is 23.3-b01   MaxHeapFreeRatio = 70   MaxHeapSize      = 1610612736 (1536.0MB)   MaxNewSize       = 17592186044415 MB   MaxPermSize      = 536870912 (512.0MB)
Other Java Memory Tips 

Check Java Process ID 
  •  ./jps -l 

Use jstat to See GC 
  • ./jstat -gcutil <jvm proc> 10 1 

Output Info 

Here is a list of acronyms used in the above output. 
  • S0 Survivor space 0 
  • S1 Survivor space 1 
  • E Eden Generation 
  • O Old Generation 
  • P Permanent Generation 
  • YGC Young GC Count 
  • YGCT Young GC time 
  • FGC Full GC Count 
  • FGCT Full GC time 
  • GCT Any GC time 
--- 

No comments:

Post a Comment