Pinpoint
是韓國人編寫的 APM 系統(tǒng)性穿,是一個分析大規(guī)模分布式系統(tǒng)的平臺,并提供處理大量跟蹤數(shù)據(jù)的解決方案雷滚。
Pinpoint
特點
- 分布式事務(wù)追蹤需曾,跟蹤跨分布式應(yīng)用的消息
- 自動檢測應(yīng)用拓展
- 水平擴(kuò)展,以便支持大規(guī)模服務(wù)器集群
- 提供代碼級了踐行,便于定位失敗點和瓶頸
- 提供字節(jié)碼增強(qiáng)技術(shù)呆万,添加新功能無需修改代碼
優(yōu)勢
- 非侵入式:使用字節(jié)碼增強(qiáng)技術(shù)商源,添加新功能無需修改代碼
- 資源消耗小:對性能影響最心奔酢(資源使用量增加約3%)
架構(gòu)模塊
- HBase:主要用于存儲數(shù)據(jù)
- Pinpoint Collector:部署在 Web 容器上
- Pinpoint Web:部署在 Web 容器上
- Pinpoint Agent:附加到用于分析的 Java 應(yīng)用程序
流程:首先通過 agent 收集調(diào)用應(yīng)用的數(shù)據(jù)牡彻,將數(shù)據(jù)發(fā)送到 collector,collector 通過處理和分析數(shù)據(jù)出爹,最后存儲到 HBase 中庄吼,可以通過 Pinpoint Web UI 查看已經(jīng)分析好的調(diào)用分析數(shù)據(jù)
數(shù)據(jù)結(jié)構(gòu)
- Span:RPC 跟蹤的基本單位,表示 RPC 到達(dá)時處理的工作严就,包含跟蹤數(shù)據(jù)总寻。Span 將子項標(biāo)記未 SpanEvent,作為數(shù)據(jù)結(jié)構(gòu)盈蛮,每個 Span 包含一個 TraceId
- Trace:一系列跨度废菱,由相關(guān)的 RPC(Span) 組成。同一跟蹤中的跨距共享相同的 TransactionId抖誉。Trace 通過 SpanIds 和 ParentSpanIds 排序為分層樹結(jié)構(gòu)
- TraceId:由 TransactionId殊轴、SpanId、ParentSpanId 組成的秘鑰集合袒炉。
TransactionId
代表消息id旁理,SpanId 和 ParentSpanId 表示 RPC 父子關(guān)系
TransactionId:來自單個事務(wù)的分布式系統(tǒng)發(fā)送、接收的消息id我磁,必須在整個服務(wù)器組是全局唯一的
SpanId:接收 RPC 消息時處理的作業(yè) ID孽文,是在 RPC 到達(dá)節(jié)點時生成的
ParentSpanId:生成 RPC 的父 span 的 spanId,如果節(jié)點是事務(wù)的起始點夺艰,不會有父跨度芋哭。
兼容性
JDK 兼容性
Pinpoint 版本 | Agent 需要的 JDK 版本 | Collector 需要的 JDK 版本 | Web 需要的 JDK 版本 |
---|---|---|---|
1.0.x | 6-8 | 6+ | 6+ |
1.1.x | 6-8 | 7+ | 7+ |
1.5.x | 6-8 | 7+ | 7+ |
1.6.x | 6-8 | 7+ | 7+ |
1.7.x | 6-8 | 8+ | 8+ |
1.8.x | 6-8,9+ | 8+ | 8+ |
Base 兼容性
Pinpoint 版本 | HBase 0.94.x | HBase 0.98.x | HBase 1.0.x | HBase 1.1.x | HBase 1.2.x |
---|---|---|---|---|---|
1.0.x | √ | × | × | × | × |
1.1.x | × | not tested | √ | not tested | not tested |
1.5.x | × | not tested | √ | not tested | not tested |
1.6.x | × | not tested | not tested | not tested | √ |
1.7.x | × | not tested | not tested | not tested | √ |
1.8.x | × | not tested | not tested | not tested | √ |
Agent-Collector 兼容性
Agent 版本 | Collector 1.0.x | Collector 1.1.x | Collector 1.5.x | Collector 1.6.x | Collector 1.7.x | Collector 1.8.x |
---|---|---|---|---|---|---|
1.0.x | √ | √ | √ | √ | √ | √ |
1.1.x | not tested | √ | √ | √ | √ | √ |
1.5.x | × | × | √ | √ | √ | √ |
1.6.x | × | × | not tested | √ | √ | √ |
1.7.x | × | × | × | × | √ | √ |
1.8.x | × | × | × | × | × | √ |
Flink 兼容性
Pinpoint 版本 | flink 1.3.x | flink 1.4.x |
---|---|---|
1.7.x | √ | × |
實例
HBase 版本為 1.2.11,下載地址:http://mirrors.hust.edu.cn/apache/hbase/hbase-1.2.11/
Pinpoint 版本為 1.7.3郁副,下載地址:https://github.com/naver/pinpoint/releases/tag/1.7.
Tomcat 版本為:8.x
其中减牺,Pinpoint 需要下載 agent
、collector
存谎、web
三個文件拔疚。
HBase
啟動 HBase
解壓 HBase,修改 config/hbase-env.sh
中 JAVA 目錄
修改后啟動 HBase: ./bin/start-hbase.sh
starting master, logging to /opt/hbase/bin/../logs/hbase-root-master-localhost.localdomain.out
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option PermSize=128m; support was removed in 8.0
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
稍等片刻后既荚,jps
查看是否啟動完成稚失,若出現(xiàn) HMaster
,則啟動完成:
加載 Pinpoint HBase 腳本
在 https://github.com/naver/pinpoint/tree/master/hbase/scripts 中恰聘,獲取 hbase-create.hbase
句各、hbase-drop.hbase
文件吸占,新建目錄 hbase-script
,執(zhí)行腳本:
./bin/hbase shell /root/hbase-script/hbase-create.hbase
Pinpoint
啟動 Collector诫钓、Web
將 tomcat 解壓為2個包旬昭,分別為 collector
、web
菌湃,刪除 tomcat 目錄下 webapps 下除 ROOT
的文件夾问拘,并刪除 ROOT
下所有文件。
將 collector惧所、web 分別解壓至對應(yīng) tomcat 的 ROOT 目錄下骤坐,解壓命令:
jar -xvf pinpoint-collector-1.7.3.war
分別修改兩個 tomcat 的 config/server.xml
文件,修改端口 8005
下愈、8080
纽绍、8443
、8009
端口势似,然后分別啟動兩個 tomcat拌夏。啟動成功后訪問 zipkin:http://192.168.67.136:28080/#/main
配置 Agent
創(chuàng)建四個文件夾:eureka
、provider
履因、consumer
障簿、zuul
,并將四個服務(wù)移入對應(yīng)文件夾栅迄,解壓 agent.tar.gz站故,將解壓后的文件放入四個文件夾:
配置 agent 中的 pinpoint.config
文件,修改 profiler.collector.ip
設(shè)置為 pinpoint-collector
的地址毅舆,如果在同一個服務(wù)器上西篓,不用修改。
可以看到在 pinpoint.config
中監(jiān)聽了 9994
憋活、9995
岂津、9996
端口,這三個端口在 collector 啟動后就開啟了悦即,默認(rèn)即可寸爆。如果 collector 需要修改端口,需要修改 $COLLECTOR_TOMCAT_HOME/webapps/ROOT/WEB-INF/classes/pinpoint-collector.properties
文件盐欺。
啟動服務(wù)
參數(shù)解釋:
-Dpinpoint.agentId
:表示 agent 的唯一標(biāo)識
-Dpinpoint.applicationName
:表示用用名稱
eureka
java -javaagent:/usr/local/src/pinpoint/soft/eureka/pinpoint-agent-1.7.3/pinpoint-bootstrap-1.7.3.jar -Dpinpoint.agentId=eureka-server -Dpinpoint.applicationName=eureka-server -jar spring-cloud-eureka-server-simple-0.0.1-SNAPSHOT.jar
provider
java -javaagent:/usr/local/src/pinpoint/soft/eureka/pinpoint-agent-1.7.3/pinpoint-bootstrap-1.7.3.jar -Dpinpoint.agentId=provider -Dpinpoint.applicationName=provider -jar spring-cloud-apm-skywalking-provider-0.0.1-SNAPSHOT.jar
consumer
java -javaagent:/usr/local/src/pinpoint/soft/eureka/pinpoint-agent-1.7.3/pinpoint-bootstrap-1.7.3.jar -Dpinpoint.agentId=consumer -Dpinpoint.applicationName=consumer -jar spring-cloud-apm-skywlaking-consumer-0.0.1-SNAPSHOT.jar
zuul
java -javaagent:/usr/local/src/pinpoint/soft/eureka/pinpoint-agent-1.7.3/pinpoint-bootstrap-1.7.3.jar -Dpinpoint.agentId=zuul -Dpinpoint.applicationName=zuul -jar spring-cloud-apm-skywalking-zuul-0.0.1-SNAPSHOT.jar -Xms256m -Xmx256m
成功啟動后,訪問 pinpoint:http://192.168.67.136:28080/#/main
通過 zuul 獲取數(shù)據(jù):http://192.168.67.136:9020/client/get-info
再次查看 pinpoint仅醇,切換到 zuul 選項卡:
紅色代表調(diào)用失斎呙馈(第一次調(diào)用時需要從 eureka 獲取數(shù)據(jù),默認(rèn)超時一秒)析二。數(shù)字代表調(diào)用次數(shù)
Inspector
:檢查器粉洼,可以查看服務(wù)的調(diào)用信息节预。點擊查看:
在 Inspector
中,Timeline 選項卡顯示請求時間段属韧,information
選項卡顯示當(dāng)前節(jié)點啟動的信息安拟,包括:應(yīng)用名、agentId
宵喂、啟動時間等糠赦,Heap Usage
顯示堆使用情況,JVM/System Cpu Usage
顯示 CPU 使用情況锅棕,Active Thread
顯示線程使用情況拙泽。Response Time
顯示響應(yīng)時間,Data Source
顯示數(shù)據(jù)庫使用情況