If there is high CPU we need to figure out which thread or part of code is taking most of the CPU.
Environment
All
Resolution
When you observe HIGH CPU collect the following information:
1) 5 thread dumps at interval of 5 seconds each. +++++++++++++++ How to take thread dump: ‘jstack’ is an effective command line tool to capture thread dumps. Here is the command that you need to issue to capture thread dump:
jstack -l <pid> > <file-path> e.g jstack -l 37320 > /opt/tmp/threadDump.txt If the process is hung then issue: jstack -F -l <pid> > <file-path +++++++++++++++ 2) Heap dump. ++++++++++ How to take HEAP dump: jmap -dump:format=b,file=c:\temp\heap.hprof <PID> ++++++++++ 3) BW appnode logs. You can find the log file under <BW_HOME>\bw\<BW_VERSION>\domains\<DOMAIN_NAME>\appnodes\<APPSPACE_NAME>\<APPNODE_NAME>\log 4) Top command output. Command is top -p <PID> > topbw.log 5) Top threads using jvmtop. The command is jvmtop.sh <PID> > bwthreads.log 6) Method level CPU profiling data using jvmtop. The command is jvmtop.sh --profile <PID> > bwprofile.log
7. Run the following command: >>>>>>>>>>>>>>>>>> ps -mo pid,lwp,stime,time,cpu -p <bwappnode_pid>(In few system we have to use pcpu instead of cpu) >>>>>>>>>>>>>> Keep the output to a file
jstack and jmap tools are shipped in JDK_HOME/bin(Note this is JDK folder and not the JRE folder).
Jvmtop needs JDK so we need to set the JAVA_HOME and add to the path.
Jvmtop can be downloaded from https://github.com/patric-r/jvmtop/releases
Below is link of JVM top documentation for your reference: