- Take a thread dump when the issue is with CPU
- Go for heap dump if this is affecting high memory usage
- Replicate similar load testing in some other environment.
- Do performance Baselining/Benchmarking.
List of java process running :
jcmd -l
Java Histogram : To get java object statistics
jmap -histo <process_id> > histogram_current_time.txt
*Strings are not part of object size in the above results
Get Threaddump:
jstack -l <pid>
Sometimes threads are stuck and other threads are blocked , this causes shooting up heap uses
HeapDump:
jmap -dump:format=b,file=<relative>/heap.bean
Profiling Tool:
Jconsole:
Open jconsole
adding remote host:port and credential
It will show dashboards for heap memory, thread, class,cpu usage, VM summary,Mbeans
Mbeans is useful to do lot of java exposed operation
-By seeing the memory usage diff between before and after an operation, the increase in memory tells the memory utilisation in an activity or set of objects.
-You can trigger GC run to clean up unused objects.
visualVM:
Add new jmx connection:hostname:port/credentials
we can take snapshot, do cpu sampling
Both the above tools allow perform GC,
visual VM has option to get heap dump, it saves on the m/c java is running.
Profiling Tool:
Jconsole:
Open jconsole
adding remote host:port and credential
It will show dashboards for heap memory, thread, class,cpu usage, VM summary,Mbeans
Mbeans is useful to do lot of java exposed operation
-By seeing the memory usage diff between before and after an operation, the increase in memory tells the memory utilisation in an activity or set of objects.
-You can trigger GC run to clean up unused objects.
visualVM:
Add new jmx connection:hostname:port/credentials
we can take snapshot, do cpu sampling
Both the above tools allow perform GC,
visual VM has option to get heap dump, it saves on the m/c java is running.
JVisualVM
- jvosualvm, JDK provided tool