I have a Spring boot application running on internal cloud foundry space. I want to monitor the Stack and Heap memory of this web app, in order to find a StackOverflow exception originating from code.
What could be the best way to profile the application.
To test profiling on your local machine run theapp
with the following JMX configuration and then go to the last step "3. VisualVM configuration" :
java \\ -Dcom.sun.management.jmxremote=true \\ -Djava.rmi.server.hostname=localhost \\ -Dcom.sun.management.jmxremote.port=9999 \\ -Dcom.sun.management.jmxremote.rmi.port=9999 \\ -Dcom.sun.management.jmxremote.ssl=false \\ -Dcom.sun.management.jmxremote.authenticate=false \\ -jar theapp.jar ...
To pass the JMX configuration to theapp
in CF use the JBP_CONFIG_JMX
environment variable (or JAVA_OPTS
with params as above), manifest.yml
:
applications: - name: theapp buildpack: java_buildpack env: JBP_CONFIG_JMX: "{enabled: true, port: 9999}" # JAVA_OPTS: "-Dcom.sun.management.jmxremote=true -Djava.rmi.server.hostname=localhost -Dcom.sun.management.jmxremote.port=9999 -Dcom.sun.management.jmxremote.rmi.port=9999 -Dcom.sun.management.jmxremote.ssl=false -Dcom.sun.management.jmxremote.authenticate=false"
cf ssh -N -T -L 9999:localhost:9999 theapp
visualvm --jdkhome "$JAVA_HOME"
localhost:9999
cf app theapp --guid # example: 12345678-1234-1234-1234-123456789012
Get a one time password for ssh clients:
cf ssh-code # example: PolSkAjEzyKtrUdnA
Create PuTTY SSH connection:
theapp.your.cloud
2222
cf:<app-guid>/<app-instance-index>@ssh.your.cloud
cf:12345678-1234-1234-1234-123456789012/0@ssh.your.cloud
<ssh-code>
PolSkAjEzyKtrUdnA
9999
127.0.0.1:9999
In case you have ssh access enabled in your cloudfoundry installation, you can use JMX or Yourkit Profiler to do this.
Here are some links:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.