Skip to content

应用诊断

应用诊断介绍

基于阿里arthas对JAVA应用进行性能诊断,快速定位Java线上问题、可以在不重启JVM进程的情况下,查看程序的运行情况。线程耗时分析、方法执行分析和性能分析。

Warning

对需要诊断的应用Pod Annotation增加diagnosis: true字段

修改诊断网关配置文件

配置文件示例

  1. giraffe通过namespace定期上报Pod信息到鲁班运维平台,这里namespace支持配置多个

  2. 配置阿里云oss信息,创建内存快照、火焰图功能会将文件上传到oss

#giraffe:
# agent 以Sidecar运行在容器内
agent:
  port: 43439

# 阿里云oss AK
oss:
  accessKey:  ""
  accessSecret:  ""
  endpoint: "http://oss-cn-hangzhou.aliyuncs.com"
  bucket: "lubanDump"
  originDir: "headdump/"
  bucketDomain: "https://lubanDump.oss-cn-hangzhou.aliyuncs.com"

# controller监听端口及订阅的namespace
controller:
  port: 45459
  host: '127.0.0.1'
  # 上报namespace下的Pod信息, 多个命名空间以"|"分隔、 示例: default|test|uat
  namespace: 'prod|uat'

auth:
  # 认证token
  token: '951ebc8e-15f1-48d3-af2d-b28def327067'
  # 运维平台地址
  url: 'http://127.0.0.1:8999'

启动giraffe-gateway

giraffe-gateway通过informer订阅Pod信息,giraffe-agent以sidecar方式运行在Pod内。诊断数据将通过rpc方式传输

go run cmd/giraffe-gateway.go

I0921 09:40:33.988803   51770 giraffe_server.go:65] Start giraffe gateway listening at :45459 ...
I0921 09:40:33.988819   51770 giraffe_server.go:67] giraffe controller started successfully...
I0921 09:40:33.992119   51770 giraffe.go:64] Starting giraffe controller
I0921 09:40:33.992255   51770 shared_informer.go:223] Waiting for caches to sync for giraffe
I0921 09:40:34.593326   51770 shared_informer.go:230] Caches are synced for giraffe 
I0921 09:40:34.593403   51770 giraffe.go:163] Started syncing pods "uat/fleet-rpc-858f68785d-5jgpt" (2022-09-21 09:40:34.593399 +0800 CST m=+0.620539834)
I0921 09:40:34.593376   51770 giraffe.go:163] Started syncing pods "uat/map-7744b897f7-tfdrg" (2022-09-21 09:40:34.593374 +0800 CST m=+0.620514959)
I0921 09:40:34.593438   51770 giraffe.go:163] Started syncing pods "uat/order-rpc-b7678ddd8-dhzg4" (2022-09-21 09:40:34.59343 +0800 CST m=+0.620570959)
I0921 09:40:34.593393   51770 giraffe.go:163] Started syncing pods "uat/pay-rpc-65474dffbc-kzlkr" (2022-09-21 09:40:34.593384 +0800 CST m=+0.620524709)
I0921 09:40:34.593477   51770 giraffe.go:165] Finished syncing pods "uat/order-rpc-b7678ddd8-dhzg4" (45.5µs)
I0921 09:40:34.593477   51770 giraffe.go:165] Finished syncing pods "uat/fleet-rpc-858f68785d-5jgpt" (76.5µs)
I0921 09:40:34.593488   51770 giraffe.go:165] Finished syncing pods "uat/map-7744b897f7-tfdrg" (112.334µs)
I0921 09:40:34.593509   51770 giraffe.go:163] Started syncing pods "uat/base-rpc-bff4cfccf-fq96w" (2022-09-21 09:40:34.593507 +0800 CST m=+0.620648126)
I0921 09:40:34.593515   51770 giraffe.go:165] Finished syncing pods "uat/base-rpc-bff4cfccf-fq96w" (6.417µs)
I0921 09:40:34.593456   51770 giraffe.go:163] Started syncing pods "uat/ronge-689f9c4b57-zfcdr" (2022-09-21 09:40:34.593452 +0800 CST m=+0.620593251)
I0921 09:40:34.593518   51770 giraffe.go:163] Started syncing pods "uat/manage-back-644895c8b-m4zff" (2022-09-21 09:40:34.593515 +0800 CST m=+0.620656126)
I0921 09:40:34.593523   51770 giraffe.go:165] Finished syncing pods "uat/ronge-689f9c4b57-zfcdr" (68.917µs)
I0921 09:40:34.593526   51770 giraffe.go:165] Finished syncing pods "uat/manage-back-644895c8b-m4zff" (9.167µs)
I0921 09:40:34.593529   51770 giraffe.go:163] Started syncing pods "uat/dispatch-758cc997cb-2dhqh" (2022-09-21 09:40:34.593525 +0800 CST m=+0.620665543)
I0921 09:40:34.593572   51770 giraffe.go:165] Finished syncing pods "uat/dispatch-758cc997cb-2dhqh" (45.583µs)
I0921 09:40:34.593578   51770 giraffe.go:163] Started syncing pods "uat/risk-7b84d4479d-pnn5n" (2022-09-21 09:40:34.593577 +0800 CST m=+0.620717376)
I0921 09:40:34.593581   51770 giraffe.go:165] Finished syncing pods "uat/risk-7b84d4479d-pnn5n" (4µs)
......

线程状态

源码查看

线程堆栈

JVM信息

Back to top