I'm need to get a JVM heap dump from an Elastic Beanstalk server, but the server doesn't have jcmd or jmap. Amazon doesn't natively install them with the JDK. Here's what's installed:
[ec2-user@ip-x-x-x-x ~]$ sudo yum list installed|grep jdk
java-1.7.0-openjdk.x86_64 1:1.7.0.111-2.6.7.2.68.amzn1 @amzn-updates
java-1.8.0-openjdk.x86_64 1:1.8.0.101-3.b13.24.amzn1 @amzn-updates
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.101-3.b13.24.amzn1 @amzn-updates
What's the best way to get a heap dump from the JVM on Elastic Beanstalk?
I have found you can install jmap by installing the correct package:
sudo yum install java-1.8.0-openjdk-devel
This should at least allow a heap dump to be generated.
In addition, to make sure all functions in jmap run, also install:
sudo yum --enablerepo='*-debug*' install java-1.8.0-openjdk-debuginfo
Although this might depend on the baseline, tomcat version etc you use.
When creating a heap dump, use the tomcat user:
sudo -u tomcat jmap -dump:live,file=/tmp/test.hprof <pid>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With