Best method for inspecting Elastic Beanstalk JVM heap

这一生的挚爱 提交于 2019-12-04 16:58:36

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>
Mark Bramnik

Disclamer: I've never worked with Elastic Beanstalk, but I can recommend to check the following:

Consider taking the heap dump programmatically, I mean from within the Java application itself. There are many ways of doing that:

  • Via JMX - the chances are that you'll find HotSpotDiagnostic bean and will be able to invoke the heap dump operation (Here there is a tutorial for doing this)

  • If your application is new and you have Spring Boot, then probably its possible to plug Spring Actuator that has a "/heapdump" endpoint just for this purpose

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!