You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@kafka.apache.org by "Kuan Po Tseng (Jira)" <ji...@apache.org> on 2024/06/14 08:38:00 UTC
[jira] [Resolved] (KAFKA-16942) Use ConcurrentHashMap in RecordAccumulator#nodeStats
[ https://issues.apache.org/jira/browse/KAFKA-16942?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Kuan Po Tseng resolved KAFKA-16942.
-----------------------------------
Resolution: Won't Do
The performance in get method is not obvious between ConcurrentHashMap and CopyOnWriteMap. And doing this breaks the code consistency (some place use CopyOnWriteMap while some are not). This seems not bring too much benefit.
> Use ConcurrentHashMap in RecordAccumulator#nodeStats
> ----------------------------------------------------
>
> Key: KAFKA-16942
> URL: https://issues.apache.org/jira/browse/KAFKA-16942
> Project: Kafka
> Issue Type: Improvement
> Components: clients
> Reporter: Kuan Po Tseng
> Assignee: Kuan Po Tseng
> Priority: Major
>
> per discussed in [https://github.com/apache/kafka/pull/16231#discussion_r1635345881]
> Through the ConcurrentMapBenchmark, we observed that in scenarios where write operations (i.e., computeIfAbsent) constitute 10%, the get performance of CopyOnWriteMap is lower compared to ConcurrentHashMap. However, when iterating over entrySet and values, CopyOnWriteMap performs better than ConcurrentHashMap.
> In RecordAccumulator#nodeStats, the computeIfAbsent method is rarely triggered, and we only use the get method to read data. Therefore, switching to ConcurrentHashMap would gain better performance.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)