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:9999cf 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.cloud2222cf:<app-guid>/<app-instance-index>@ssh.your.cloud
cf:12345678-1234-1234-1234-123456789012/[email protected]<ssh-code>
PolSkAjEzyKtrUdnA9999127.0.0.1:9999If 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