Wednesday, March 4, 2020

Thread Dump in Java

Steps to take thread dump in Java in Windows

1. Download PSTools from below link
https://docs.microsoft.com/en-us/sysinternals/downloads/pstools
2. Use below command to take thread dump:

psexec -s <Path_to_JDK_bin_folder>\jstack.exe -l <process_id> ><PATH_WITH_FILE_NAME_FOR_DUMP>

e.g.
psexec -s D:\jdk1.8.0_171\bin\jstack.exe -l 319732 >D:\dump.txt

3. Download IBM Thread Dump Analyzer(TDA) from below link
https://public.dhe.ibm.com/software/websphere/appserv/support/tools/jca/jca465.jar

4. Double click on the jar to open
5. Click on File-->Open Thread Dumps.
6. Choose the thread dump file
7. Click on Analysis-->Thread Status Analysis
 


Details on TDA can be found here 


Useful Production Profiling links

Few days ago I was looking for a Profiling to be done on Production environment. Earlier, I used to use JProfiler & JavaMelody for performance / issue debugging in production environment.

But , of late I found Alibaba has created a new profiling tool for production usage. The below link contains the details. Please check out. Seems interesting

https://medium.com/@Alibaba_Cloud/troubleshooting-production-issues-with-alibabas-arthas-68d8ec2824d7


Convert Java Project from Log4j 1 to Log4j2

Many times while working on old Java projects we find Log4j 1.x is used. But as the Log4j2 is the new one; hence to upgrade to Log4j2 we nee...