How to gather histogram, thread dump and heap dump from GemFire process in Tanzu GemFire for VMs
search cancel

How to gather histogram, thread dump and heap dump from GemFire process in Tanzu GemFire for VMs

book

Article ID: 294382

calendar_today

Updated On:

Products

VMware Tanzu Gemfire

Issue/Introduction

What is the process of taking Java heap dump, thread dump and histograms for VMware Tanzu GemFire service instance VMs?

Environment

Product Version: 1.13

Resolution

VMware Tanzu GemFire VMs run GemFire server and locator processes under the hood to take the histograms and heap dumps.

1. bosh ssh into the VMware Tanzu Gemfire VM from where you want to take heap dump, thread dump, or histo[:live]. 

bosh -e <ENV> -d <DEPLOYMENT> ssh <server>

2. sudo su in the VM and then get into the BOSH Process Manager (bpm) shell by running the following command:

sudo /var/vcap/packages/bpm/bin/bpm shell <job-name>

Where job-name is "gemfire-server" or "gemfire-locator" depending on which VMware Tanzu Gemfire VM you are on.


3. Find the PID, which is running the GemFire Java process by running the following command:

ps -aux | grep java


4. At this point, we can gather any of the following:

a. histo:live

/var/vcap/packages/jdk8/bin/jmap -histo:live <pid> > /tmp/<fileName>.txt


b. heapdump

 /var/vcap/packages/jdk8/bin/jmap -dump:file=/tmp/<heapdump>.hprof,format=b <pid>


c. Thread dumps

For more information on thread dumps, refer to https://docs.pivotal.io/p-cloud-cache/1-13/troubleshooting.html

Note: Make sure to redirect the output to different files each time. Files in the /tmp will be visible under /var/vcap/data/gemfire-<process>/tmp directory on the VM.


5. Run this command: chmod a+x /var/vcap/data/gemfire-server/tmp/<file>.txt

6. Exit from the VCAP user.

7. Move the files to the /tmp directory on the VM by running the following command.

mv var/vcap/data/gemfire-server/tmp/histo1.txt /tmp/

Note: Make sure that the file has read permission else scp will not be successful.

8. Exit from sudo from the GemFire VM.

9. Exit from the GemFire VM.

10. Files can be SSH'd to your local machine using the bosh scp command. From your local machine, run the following command. 

bosh -d <service-instance> scp <VM>:/tmp/<file>.txt /tmp