Collect JVM runtime information

2024-04-01 09:12:16  Updated

This topic describes how to collect Java Virtual Machine (JVM) runtime information.

Step 1: Log on to the ODC Docker container

# View the name of the ODC Docker container.
docker ps | grep odc

# Go to the ODC Docker container. Assume that the ODC Docker container name is odc.
docker exec -it odc sh

Step 2: Use the jps command to obtain the process number

Here is the sample command:

jps | grep odc

Here is the sample response:

67255 odc-web-starter-3.3.0-SNAPSHOT-executable.jar

62277 is the process number.

Step 3: Capture the thread dump

Use the following syntax:

jstack ${ODC_PID} > ${THREAD_DUMP_FILE_NAME}

Here is the sample command:

jstack 67255 > /home/admin/odcthreaddump.txt

Step 4: Capture the heap dump

Use the following syntax:

jmap -dump:live,format=b,file=${HEAP_DUMP_FILE_NAME} ${ODC_PID}

Here is the sample command:

jmap -dump:live,format=b,file=/home/admin/odcdump.hprof 67255

Step 5: Copy the dump file

/home/admin/odcthreaddump.txt obtained in step 3 and /home/admin/odcdump.hprof obtained in step 4 are the dump files.

Contact Us