点滴记忆

搭建的站点

使用planuml分析springboot、springCloud、SpringCloudAlibaba的pom依赖关系

2021-7-29 Saber

springboot

@startuml

hide empty circle
hide empty members
skinparam shadowing false

rectangle "spring-boot-build:2.2.14.RELEASE" as bootBuild #lightgreen
rectangle "spring-boot-dependencies:2.2.14.RELEASE" as bootDependencies #lightgreen
rectangle "spring-boot-parent:2.2.14.RELEASE" as bootParent #lightgreen

rectangle "spring-boot:2.2.14.RELEASE" as bootCore #skyblue
rectangle "spring-boot-actuator:2.2.14.RELEASE" as bootActuator #skyblue
rectangle "spring-boot-starters:2.2.14.RELEASE" as bootStarters #skyblue
rectangle "spring-boot-devtools:2.2.14.RELEASE" as bootDevtools #skyblue
rectangle "..." as bootParentOther #skyblue

rectangle "spring-boot-starter:2.2.14.RELEASE" as bootStarter
rectangle "spring-boot-starter-activemq:2.2.14.RELEASE" as bootStarterActivemq  #yellow
rectangle "spring-boot-starter-aop:2.2.14.RELEASE" as bootStarterAop   #yellow
rectangle "..." as starterOther

bootBuild <|-- bootDependencies
bootDependencies <|-- bootParent

bootParent <|-- bootCore
bootParent <|-- bootActuator
bootParent <|-- bootDevtools
bootParent <|-- bootStarters
bootParent <|-- bootParentOther

bootStarters <|-- bootStarter
bootStarters <|-- bootStarterActivemq
bootStarters <|-- bootStarterAop
bootStarters <|-- starterOther

bootStarter ..> bootCore

bootStarterActivemq ..> bootStarter
bootStarterAop ..> bootStarter

@enduml

springCloud

@startuml

hide empty circle
hide empty members
skinparam shadowing false

rectangle "spring-boot-dependencies:2.2.14.RELEASE" as bootDependencies #pink
rectangle "spring-cloud-build-dependencies:2.2.14.RELEASE" as dependencies #pink

rectangle "spring-cloud-build:2.2.14.RELEASE" as build #pink
rectangle "spring-cloud-dependencies-parent:2.2.14.RELEASE" as dependenciesParent #pink

rectangle "spring-cloud-gateway-dependencies:2.2.14.RELEASE" as gatewayDependencies #lightgreen
rectangle "spring-cloud-gateway:2.2.14.RELEASE" as buildGateway #lightgreen

rectangle "spring-cloud-gateway-core:2.2.14.RELEASE" as gatewayCore
rectangle "spring-cloud-starter-gateway:2.2.14.RELEASE" as gatewayStarter #yellow
rectangle "spring-cloud-gateway-mvc:2.2.14.RELEASE" as gatewayMVC
rectangle "spring-cloud-gateway-sample:2.2.14.RELEASE" as gatewaySample
rectangle "spring-cloud-gateway-server:2.2.14.RELEASE" as gatewayServer
rectangle "spring-cloud-gateway-webflux:2.2.14.RELEASE" as gatewayWebflux

rectangle "spring-cloud-commons-dependencies:2.2.14.RELEASE" as cloudCommonsDependencies #pink
rectangle "spring-cloud-netflix-dependencies:2.2.14.RELEASE" as cloudNetflixDependencies #pink
rectangle "spring-cloud-circuitbreaker-dependencies:2.2.14.RELEASE" as cloudCircuitbreakerDependencies #pink


bootDependencies <|-- dependencies
build <|-- buildGateway
dependenciesParent <|-- gatewayDependencies
buildGateway <|-- gatewayCore
buildGateway <|-- gatewayMVC
buildGateway <|-- gatewaySample
buildGateway <|-- gatewayServer
buildGateway <|-- gatewayWebflux
buildGateway <|-- gatewayStarter

build o-- dependencies #gray
gatewayDependencies --o buildGateway  #gray
cloudCommonsDependencies --o buildGateway #gray
cloudNetflixDependencies --o buildGateway #gray
cloudCircuitbreakerDependencies --o buildGateway #gray

@enduml

SpringCloudAlibaba

@startuml

hide empty circle
hide empty members
skinparam shadowing false

rectangle "spring-cloud-build:2.3.1.RELEASE" as cloudBuild #pink
rectangle "spring-cloud-alibaba:2.2.6-SNAPSHOT" as cloudAlibaba #lightgreen
rectangle "spring-boot-dependencies:2.3.2.RELEASE" as bootDependencies #lightblue
rectangle "spring-cloud-dependencies:Hoxton.SR9" as cloudDependencies #pink
rectangle "dubbo-dependencies-bom:2.7.8" as dubboDependencies #pink

rectangle "spring-cloud-dependencies-parent:2.3.1.RELEASE" as cloudDependenciesParent #pink
rectangle "spring-cloud-alibaba-dependencies:2.2.6-SNAPSHOT" as cloudAlibabaDependencies #lightgreen
rectangle "spring-cloud-alibaba-starters:2.2.6-SNAPSHOT" as cloudAlibabaStarter #grey
rectangle "spring-cloud-starter-dubbo:2.2.6-SNAPSHOT" as starterDubbo #yellow
rectangle "spring-cloud-starter-alibaba-nacos-discovery:2.2.6-SNAPSHOT" as starterNacosDiscovery #yellow
rectangle "..." as starterOther #yellow

rectangle "spring-cloud-alibaba-examples:2.2.6-SNAPSHOT" as alibabaExamples
rectangle "nacos-config-example:2.2.6-SNAPSHOT" as nacosConfigExamples
rectangle "spring-cloud-alibaba-dubbo-examples:2.2.6-SNAPSHOT" as dubboExamples
rectangle "..." as exampleOther

cloudBuild <|-- cloudAlibaba
cloudDependenciesParent <|-- cloudAlibabaDependencies
cloudDependenciesParent <|-- cloudDependencies

cloudAlibabaDependencies --o cloudAlibaba #gray
bootDependencies --o cloudAlibaba #gray
cloudDependencies --o cloudAlibaba #gray
dubboDependencies --o cloudAlibaba #gray

cloudAlibaba  <|-- cloudAlibabaStarter
cloudAlibabaStarter <|-- starterDubbo
cloudAlibabaStarter <|-- starterNacosDiscovery
cloudAlibabaStarter <|-- starterOther
cloudAlibaba  <|-- alibabaExamples
alibabaExamples  <|-- nacosConfigExamples
alibabaExamples  <|-- dubboExamples
alibabaExamples  <|-- exampleOther

@enduml


标签: java springboot springcloud planuml

评论(0) 浏览(40)

JVM排查问题

2021-7-28 Saber


CPU占用飙升

1. top 找到CPU占用最大的进程 (shift+c按CPU占用量排序)

2. top -Hp pid 找到进程中CPU占用最大的线程

3. printf '%x' ThreadId 将线程ID转换成十六进制

4. jstack pid|grep 'ThreadId' -C5 -color 打印堆栈信息


查找死锁

1. jps -l

2. jstack -l pid 打印堆栈信息

内存泄漏

1. jmap -head pid 查看内存使用情况



2. jstat -gcutil pid 1000 查看GC情况

3. jmap -histo:live pid|more 查看对象内存占用情况(执行之后,会造成jvm强制执行一次GC,线上谨慎使用

Memory Analyzer Tool (MAT)

1. jmap -dump:format=b,file=/root/dump.hprof pid 导出堆快照文件
 
2. 用MAT进行分析

minor gc、major gc、full gc执行频率,计算时间占比。





其他:

1.1 Jstat 查看堆内存、元数据各部分的使用量,以及加载类的数量。

1.2 Jinfo 用来查看正在运行的java应用程序的扩展参数(JVM中-X标示的参数),甚至支持在运行时修改部分参数。

1.3 Jstack 用于查看线程状态。

1.4 Jmap JVM Memory Map命令用于生成heap dump文件,还可以查询finalize执行队列、Java堆和永久代的详细信息,如当前使用率、当前使用的是哪种收集器等。

1.5 Jhat (web版本的MAT)配合Jmap导出的dump文件使用。jhat内置http server,用hql语法查看dump文件。

1.6 Jprofier 分析内存分布情况,定位内存泄漏等问题。

标签: java jvm

评论(0) 浏览(41)