How to capture Thread dumps of a JVM on a windows server

This video walks through the steps to capture heap dumps of a JVM on a windows server.

Transcript
Hello, everyone. Today we will be discussing how to capture thread dumps of a JVM on a Windows server. Our JDK provides several utilities that can can capture the thread dump of a Java application. These utilities are located under the bin folder inside the JDK home directory. So today we’ll be seeing different ways of generating thread dump. One of the most commonly used utility is jstat. It takes the PID of a process and displays the thread dump in the console. For example, if you see on the screen the PID of a certain Java process here is 9784, which we found from the Task Manager. Now we’ll open up the Command Prompt and use the PID in the command shown on the screen to generate a thread dump text file in the current directory.
Next, we can use JMC to look into thread dumps of our Java processes. So to open JMC, we can go to the bin folder under JDK, and then click on JMC to launch the application. Once the JMC has opened up, we can right-click on a particular process, and click on, “Start file recording.” On clicking the option, the recording would automatically start.
Once the recording has been completed, we can click on the “Threads” tab, and then go to thread dump to view the thread dump of a particular process.
Also, we can use JConsole, which lets us inspect the stack trace of each thread. To open JConsole, we can follow the similar process by going into the bin folder in JDK and clicking on JConsole to launch the application. This will open up the JConsole application. Once the JConsole has been opened and connected to a running Java process, we can navigate to the threads tab and find each thread’s stack trace.
So, in these ways, we can successfully capture thread dumps of a JVM. Thank you. -
recommendation-more-help
8de24117-1378-413c-a581-01e660b7163e