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.
bosh -d <service-instance> scp <VM>:/tmp/<file>.txt /tmp