jboss handy commands for production support

For a support guy in production environment or dev environment if we want to know the performance of a jboss process and it usage refer below commands .

How to find JBoss PID

ps -ef |grep jboss

How to perform a Thread Dump

Option 1)$ kill -3 JBOSSPID

Option 2)$ jstack -l JBOSSPID > jstack.out

Replace JBOSSPID with the Application server’s PID

How to count the number of Threads running

On linux architectures, you can count the number of running threads (as lightweight processes) as follows:

$ ps -eLf | grep [PID] | wc -l

How to check the CPU usage of a Thread

Thread are qualified by Linux Operating system as lightweight processes. You have to execute at first top to retrieve the CPU usage of a Thread Id:

$ top -b -n 1 -H -p JBOSSPID

Test the above command and monitor the usage

Now that you have identified the top CPU consuming Thread ids (Column PID), check their stack trace to see what’s going on

How to monitor the Java Process size (using pmap)

pmap -x <pid>

How to store the amount of RSS (Process Resident Size) of a process in a variable

Assumed that the outout of pmap has been stored in a file named pmap.log:

export JVMSIZE=$(grep "total kB" pmap.log | awk '{print $4}')

How to monitor the Java Native Memory: (Requires JDK!):

Include the following settings in your JDK:

-XX:+UnlockDiagnosticVMOptions -XX:NativeMemoryTracking=detail -XX:+PrintNMTStatistics

Then, execute the following command against the Java PID:

jcmd <pid> VM.native_memory

How to monitor a Java Process Heap size: (Requires JDK!)

jmap -heap PID

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *