Kafka常用JMX监控指标整理【实战笔记】

目录
一、系统相关指标
二、GC相关指标
三、JVM相关指标
四、Topic相关指标
五、Broker相关指标
一、系统相关指标

1.系统信息收集
java.lang:type=OperatingSystem

{"freePhysicalMemorySize":"806023168","maxFileDescriptorCount":"4096","openFileDescriptorCount":"283","processCpuLoad":"0.0017562901839817224","systemCpuLoad":"0.014336627412954635","systemLoadAverage":"0.37"}

2.Thread信息收集
java.lang:type=Threading

{"peakThreadCount":"88","threadCount":"74"}

3.获取mmaped和direct空间

通过BufferPoolMXBean获取used、capacity、count

二、GC相关指标

1.Young GC
java.lang:type=GarbageCollector,name=G1 Young Generation

{"collectionCount":"534","collectionTime":"8258"}

2.Old GC
java.lang:type=GarbageCollector,name=G1 Old Generation

{"collectionCount":"0","collectionTime":"0"}
三、JVM相关指标

通过MemoryMXBean获取JVM相关信息HeapMemoryUsage和NonHeapMemoryUsage;通过MemoryPoolMXBean获取其他JVM内存空间指标,例如:Metaspace、Codespace等

四、Topic相关指标

1.Topic消息入站速率(Byte)
kafka.server:type=BrokerTopicMetrics,name=BytesInPerSec,topic=" + topic

{"count":"0","fifteenMinuteRate":"0.0","fiveMinuteRate":"0.0","meanRate":"0.0","oneMinuteRate":"0.0"}

2.Topic消息出站速率(Byte)
kafka.server:type=BrokerTopicMetrics,name=BytesOutPerSec,topic=" + topic

{"count":"0","fifteenMinuteRate":"0.0","fiveMinuteRate":"0.0","meanRate":"0.0","oneMinuteRate":"0.0"}

3.Topic请求被拒速率
kafka.server:type=BrokerTopicMetrics,name=BytesRejectedPerSec,topic=" + topic

{"count":"0","fifteenMinuteRate":"0.0","fiveMinuteRate":"0.0","meanRate":"0.0","oneMinuteRate":"0.0"}
4.Topic失败拉去请求速率

kafka.server:type=BrokerTopicMetrics,name=FailedFetchRequestsPerSec,topic=" + topic;

{"count":"0","fifteenMinuteRate":"0.0","fiveMinuteRate":"0.0","meanRate":"0.0","oneMinuteRate":"0.0"}
5.Topic发送请求失败速率

kafka.server:type=BrokerTopicMetrics,name=FailedProduceRequestsPerSec,topic=" + topic

{"count":"0","fifteenMinuteRate":"0.0","fiveMinuteRate":"0.0","meanRate":"0.0","oneMinuteRate":"0.0"}
6.Topic消息入站速率(message)

kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec,topic=" + topic
{"count":"0","fifteenMinuteRate":"0.0","fiveMinuteRate":"0.0","meanRate":"0.0","oneMinuteRate":"0.0"}

五、Broker相关指标
1.Log flush rate and time

kafka.log:type=LogFlushStats,name=LogFlushRateAndTimeMs

{"50thPercentile":"1.074103","75thPercentile":"1.669793","95thPercentile":"6.846556","98thPercentile":"6.846556","999thPercentile":"6.846556","99thPercentile":"6.846556","count":"19","max":"6.846556","mean":"1.628646052631579","min":"0.512879","stdDev":"1.6007003364105892"}
2.同步失效的副本数

kafka.server:type=ReplicaManager,name=UnderReplicatedPartitions

{"value":"0"}
3.消息入站速率(消息数)

kafka.server:type=BrokerTopicMetrics,name=MessagesInPerSec

{"count":"86845","fifteenMinuteRate":"0.6456600497006455","fiveMinuteRate":"0.6444164288097876","meanRate":"0.5314899330400695","oneMinuteRate":"0.6494649408329609"}
4.消息入站速率(Byte)

kafka.server:type=BrokerTopicMetrics,name=BytesInPerSec

{"count":"57302357","fifteenMinuteRate":"379.11342092748146","fiveMinuteRate":"371.8482236385939","meanRate":"351.37122686037435","oneMinuteRate":"351.8348952308101"}
5.消息出站速率(Byte)

kafka.server:type=BrokerTopicMetrics,name=BytesOutPerSec

{"count":"246","fifteenMinuteRate":"4.508738367219028E-34","fiveMinuteRate":"1.4721921790135324E-98","meanRate":"0.0015031168286836175","oneMinuteRate":"2.964393875E-314"}
6.请求被拒速率

kafka.server:type=BrokerTopicMetrics,name=BytesRejectedPerSec

{"count":"0","fifteenMinuteRate":"0.0","fiveMinuteRate":"0.0","meanRate":"0.0","oneMinuteRate":"0.0"}
7.失败拉去请求速率

kafka.server:type=BrokerTopicMetrics,name=FailedFetchRequestsPerSec

{"count":"0","fifteenMinuteRate":"0.0","fiveMinuteRate":"0.0","meanRate":"0.0","oneMinuteRate":"0.0"}
8.发送请求失败速率

kafka.server:type=BrokerTopicMetrics,name=FailedProduceRequestsPerSec

{"count":"0","fifteenMinuteRate":"0.0","fiveMinuteRate":"0.0","meanRate":"0.0","oneMinuteRate":"0.0"}
9.Leader副本数

kafka.server:type=ReplicaManager,name=LeaderCount

{"value":"92"}
10.Partition数量

kafka.server:type=ReplicaManager,name=PartitionCount

{"value":"135"}
11.下线Partition数量

kafka.controller:type=KafkaController,name=OfflinePartitionsCount

{"value":"0"}
12.Broker网络处理线程空闲率

kafka.server:type=KafkaRequestHandlerPool,name=RequestHandlerAvgIdlePercent

{"count":"164506926671008","fifteenMinuteRate":"0.9999327359820058","fiveMinuteRate":"1.0000290054537715","meanRate":"0.9998854371393514","oneMinuteRate":"1.0007836499581673"}
13.Leader选举比率

kafka.controller:type=ControllerStats,name=LeaderElectionRateAndTimeMs

{"count":"7","fifteenMinuteRate":"5.134993718576819E-82","fiveMinuteRate":"6.882658450509451E-240","meanRate":"4.2525243043608314E-5","oneMinuteRate":"2.964393875E-314"}
14.Unclean Leader选举比率

kafka.controller:type=ControllerStats,name=UncleanLeaderElectionsPerSec

{"count":"0","fifteenMinuteRate":"0.0","fiveMinuteRate":"0.0","meanRate":"0.0","oneMinuteRate":"0.0"}
15.Controller存活

kafka.controller:type=KafkaController,name=ActiveControllerCount

{"value":"1"}
16.请求速率

kafka.network:type=RequestMetrics,name=RequestsPerSec,request=Produce

{"count":"83233","fifteenMinuteRate":"0.6303485369828705","fiveMinuteRate":"0.6357199085092445","meanRate":"0.5046486472186744","oneMinuteRate":"0.6563203475530601"}
17.Consumer拉取速率

kafka.network:type=RequestMetrics,name=RequestsPerSec,request=FetchConsumer

{"count":"125796","fifteenMinuteRate":"1.14193044007404E-33","fiveMinuteRate":"7.699516480260211E-100","meanRate":"0.7623419964866819","oneMinuteRate":"2.964393875E-314"}
18.Follower拉去速率

kafka.network:type=RequestMetrics,name=RequestsPerSec,request=FetchFollower

{"count":"375108","fifteenMinuteRate":"2.302746562040189","fiveMinuteRate":"2.292459728166488","meanRate":"2.2721808581484693","oneMinuteRate":"2.2814260196672973"}
19.Request total time

kafka.network:type=RequestMetrics,name=TotalTimeMs,request=Produce

{"50thPercentile":"1.0","75thPercentile":"1.0","95thPercentile":"2.0","98thPercentile":"2.0","999thPercentile":"28.0","99thPercentile":"4.0","count":"83384","max":"48.0","mean":"1.2344934279957787","min":"0.0","stdDev":"1.1783192073287214"}
20.Consumer fetch total time

kafka.network:type=RequestMetrics,name=TotalTimeMs,request=FetchConsumer

{"50thPercentile":"500.0","75thPercentile":"501.0","95thPercentile":"501.0","98thPercentile":"501.0","999thPercentile":"501.971","99thPercentile":"501.0","count":"125796","max":"535.0","mean":"499.83123469744663","min":"0.0","stdDev":"17.138716708632025"}
21.Follower fetch total time

kafka.network:type=RequestMetrics,name=TotalTimeMs,request=FetchFollower

{"50thPercentile":"500.0","75thPercentile":"500.0","95thPercentile":"501.0","98thPercentile":"501.0","999thPercentile":"507.826","99thPercentile":"501.0","count":"375564","max":"532.0","mean":"437.79763502359117","min":"0.0","stdDev":"148.25999023472986"}
22.Time the follower fetch request waits in the request queue

kafka.network:type=RequestMetrics,name=RequestQueueTimeMs,request=FetchFollower

{"50thPercentile":"0.0","75thPercentile":"0.0","95thPercentile":"0.0","98thPercentile":"0.0","999thPercentile":"0.0","99thPercentile":"0.0","count":"376206","max":"28.0","mean":"0.0010260336092459982","min":"0.0","stdDev":"0.1282889653905258"}
23.Time the Consumer fetch request waits in the request queue

kafka.network:type=RequestMetrics,name=RequestQueueTimeMs,request=FetchConsumer

{"50thPercentile":"0.0","75thPercentile":"0.0","95thPercentile":"0.0","98thPercentile":"0.0","999thPercentile":"0.0","99thPercentile":"0.0","count":"125796","max":"24.0","mean":"0.0018124582657636174","min":"0.0","stdDev":"0.18122860552537737"}
24.Time the Produce fetch request waits in the request queue

kafka.network:type=RequestMetrics,name=RequestQueueTimeMs,request=Produce

{"50thPercentile":"0.0","75thPercentile":"0.0","95thPercentile":"0.0","98thPercentile":"0.0","999thPercentile":"0.0","99thPercentile":"0.0","count":"83704","max":"12.0","mean":"2.6283092803211315E-4","min":"0.0","stdDev":"0.042892540270754634"}
25.Broker I/O工作处理线程空闲率

kafka.network:type=SocketServer,name=NetworkProcessorAvgIdlePercent

{"value":"1.0015540075894207"}
26.ISR变化速率

kafka.server:type=ReplicaManager,name=IsrShrinksPerSec

{"count":"0","fifteenMinuteRate":"0.0","fiveMinuteRate":"0.0","meanRate":"0.0","oneMinuteRate":"0.0"}

作者老梁,哈啰出行高级技术专家,参与了《RocketMQ技术内幕》审稿工作。专注后端中间件方向,已陆续发表RocketMQ系列、Kafka系列、gRPC系列、Sentinel系列、Java NIO系列。其中RocketMQ系列已发表40余篇。源码、实战、原理、调优期待与你一起学习。


公众号.jpg

个人微信.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 206,214评论 6 481
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,307评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 152,543评论 0 341
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,221评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,224评论 5 371
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,007评论 1 284
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,313评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,956评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,441评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,925评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,018评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,685评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,234评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,240评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,464评论 1 261
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,467评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,762评论 2 345

推荐阅读更多精彩内容

  • 鸟语花香这晨曦, 欲说各旧梦, 回千里。 炊烟点火把柴劈, 声茅茅,连称那马是。 抹崖谁故事? 清明讲谁听?将名持...
    琢壁阅读 166评论 0 0
  • 辉: 这是一个夏日的早晨。经过夜里一场风雨的洗礼,窗外的绿叶如碧玉般纯净。明媚的阳光透过窗户,把大片的光亮慷慨地洒...
    玫兰妮阅读 564评论 0 1
  • A208号别墅设计图纸及效果图介绍: 占地规格:门面20.1米X深度12.9米 一层面积:182.42平方米 二层...
    妮妮别墅阅读 18评论 0 0