# How to generate thread dumps using Visual VM

#### Still need help?

The Atlassian Community is here for you.

Platform Notice: Server and Data Center Only. This article only applies to Atlassian products on the server and data center platforms.

## Purpose

There are certain cases where you would need thread dumps to analyze the performance issue of your Confluence instance or to provide to our Support team for further analysis. Below are the steps to extract the thread dumps from Confluence or any other Java application.

This will also allow you to remotely monitor the health of the application using a different machine within the same network.

## Solution

Prerequisite : JDK must be installed to use Visual VM.

Step to do this if Confluence running as a service

1. Identify the name of the service that Confluence is installed as in Windows by going to Control Panel > Administrative Tools > Services
2. Copy the service name like the screenshot below
3. Run the command prompt and cd to the bin directory of Confluence instance.
4. Type the following command

tomcat7w//ES//Confluence210814192604

Please replace Confluence210814192604 with the service name on step 2

5. You should be able to see the tomcat UI after that like the screenshot below

You can specify any other port other than 8484 but if 8484 port is open on your end. You can just set it as that.
6. Shutdown Confluence
7. Start Confluence again for the changes to take effect
8. After that add the JMX port into visual vm

To access Visual VM, please go to jdk_installation_path/bin. The file name is jvisualvm.exe

1. Open visual vm and right click on Local and click add JMX connection
2. Specify the port as 8484 as configure on step 5 on the previous step and click ok like the screenshot below

Steps to do this if running Confluence Standalone

1. Go to <confluence_installation_folder>/bin
2. Right click on setenv.bat in Windows or setenv.sh in Linux and click edit and add the following parameters.

-Dcom.sun.management.jmxremote
-Dcom.sun.management.jmxremote.authenticate=false
-Dcom.sun.management.jmxremote.port=8484
-Dcom.sun.management.jmxremote.ssl=false

Please paste the above all in 1 line with spaces separated like the example below:

Please note that the below is an example, please do not copy and paste the parameters below, only add the parameters needed to JAVA_OPTS

set JAVA_OPTS=%JAVA_OPTS% -Xms256m -Xmx512m -XX:MaxPermSize=256m -verbose:gc -Xloggc:C:\confluence\data552/logs/gc.log -XX:+PrintGCDetails -Dcom.sun.management.jmxremote -Dcom.sun.management.jmxremote.authenticate=false -Dcom.sun.management.jmxremote.port=8484 -Dcom.sun.management.jmxremote.ssl=false

Restart Confluence after adding the parameters described above.

After that add the JMX port into Visual VM

To access Visual VM, please go to jdk_installation_path/bin. The file name is jvisualvm.exe

1. Open visual vm and right click on Local and click add JMX connection
2. Specify the port as 8484 as configure on step 5 on the previous step and click ok like the screenshot below