pri*_*sad 2 java memory-profiling cloud-foundry spring-boot
我有一个在内部云代工厂空间上运行的 Spring Boot 应用程序。我想监视此 Web 应用程序的堆栈和堆内存,以查找源自代码的 StackOverflow 异常。
分析应用程序的最佳方法是什么。
要在本地机器上测试分析,请theapp使用以下 JMX 配置运行,然后转到最后一步“3. VisualVM 配置”:
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 ...
Run Code Online (Sandbox Code Playgroud)要将 JMX 配置传递到theappCF 中,请使用JBP_CONFIG_JMX环境变量(或JAVA_OPTS使用上述参数)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"
Run Code Online (Sandbox Code Playgroud)cf ssh -N -T -L 9999:localhost:9999 theapp
Run Code Online (Sandbox Code Playgroud)
visualvm --jdkhome "$JAVA_HOME"localhost:9999java \
-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 ...
Run Code Online (Sandbox Code Playgroud)获取 ssh 客户端的一次性密码:
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"
Run Code Online (Sandbox Code Playgroud)创建 PuTTY SSH 连接:
theapp.your.cloud2222cf:<app-guid>/<app-instance-index>@ssh.your.cloud
cf:12345678-1234-1234-1234-123456789012/0@ssh.your.cloud<ssh-code>
PolSkAjEzyKtrUdnA9999127.0.0.1:9999| 归档时间: |
|
| 查看次数: |
1415 次 |
| 最近记录: |