[ https://issues.apache.org/jira/browse/KAFKA-19606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
tony tang updated KAFKA-19606: ------------------------------ Description: JMX metrics RequestHandlerAvgIdlePercent reports a value close to 2 in combined kraft mode but it's expected to be b/w 0 and 1. This is an issue with combined mode specifically because both controller + broker are using the same Meter object in combined mode, defined in {{{}RequestThreadIdleMeter#requestThreadIdleMeter{}}}, but the controller and broker are using separate {{KafkaRequestHandlerPool}} objects, where each object's {{{}threadPoolSize == KafkaConfig.numIoThreads{}}}. This means when calculating idle time, each pool divides by its own {{numIoThreads}} value before reporting to the shared meter and {{RequestHandlerAvgIdlePercent}} calculates the final result by accumulating all the values reported by all threads. However, since there are actually 2 × numIoThreads total threads contributing to the metric, the denominator should be doubled to get the correct average. was: JMX metrics RequestHandlerAvgIdlePercent reports a value close to 2 in combined kraft mode but it's expected to be b/w 0 and 1. This is an issue with combined mode specifically because both controller + broker are using the same Meter object, defined in {{{}RequestThreadIdleMeter#requestThreadIdleMeter{}}}, but the controller and broker are using separate {{KafkaRequestHandlerPool}} objects, where each object's {{{}threadPoolSize == KafkaConfig.numIoThreads{}}}. This means when calculating idle time, each pool divides by its own {{numIoThreads}} value before reporting to the shared meter and {{RequestHandlerAvgIdlePercent}} calculates the final result by accumulating all the values reported by all threads. However, since there are actually 2 × numIoThreads total threads contributing to the metric, the denominator should be doubled to get the correct average. > Anomaly of JMX metrics RequestHandlerAvgIdlePercent in kraft combined mode > -------------------------------------------------------------------------- > > Key: KAFKA-19606 > URL: https://issues.apache.org/jira/browse/KAFKA-19606 > Project: Kafka > Issue Type: Bug > Components: core > Reporter: tony tang > Assignee: tony tang > Priority: Major > > JMX metrics RequestHandlerAvgIdlePercent reports a value close to 2 in > combined kraft mode but it's expected to be b/w 0 and 1. > This is an issue with combined mode specifically because both controller + > broker are using the same Meter object in combined mode, defined in > {{{}RequestThreadIdleMeter#requestThreadIdleMeter{}}}, but the controller and > broker are using separate {{KafkaRequestHandlerPool}} objects, where each > object's {{{}threadPoolSize == KafkaConfig.numIoThreads{}}}. This means when > calculating idle time, each pool divides by its own {{numIoThreads}} value > before reporting to the shared meter and {{RequestHandlerAvgIdlePercent}} > calculates the final result by accumulating all the values reported by all > threads. However, since there are actually 2 × numIoThreads total threads > contributing to the metric, the denominator should be doubled to get the > correct average. -- This message was sent by Atlassian Jira (v8.20.10#820010)