On 2023/09/06 04:22:58 QQ wrote:
> Hi Pulsar Community,
> 
> I’d like to start a discussion about whether replacing the customize util 
> class like ConcurrentOpenHashMap with ConcurrentHashMap, as the performance 
> of ConcurrentHashMap is better than those customize util significantly. 
> Worse, these customize util class cannot ensure consistence in method forEach 
> as PR https://github.com/apache/pulsar/pull/21110 shows, which is 
> disquieting, although it may not cause any problem.
> 
> Thanks,
> The Tumbled.
> 

The benchmark results is provided in 
https://github.com/apache/pulsar/pull/20647\#issuecomment-1607257960 
<https://github.com/apache/pulsar/pull/20647%5C#issuecomment-1607257960>.


> However, iterators are designed to be used by only one thread at a time. Bear 
> in mind that the results of aggregate status methods including size, isEmpty, 
> and containsValue are typically useful only when a map is not undergoing 
> concurrent updates in other threads. Otherwise the results of these methods 
> reflect transient states that may be adequate for monitoring or estimation 
> purposes, but not for program control.

And I notice that ConcurrentHashMap’s forEach method do not support 
thread-safety too.
It seems that the only reason left for us to replacing the customized util is 
the superior performance of ConcurrentHashMap.

Thanks,
The Tumbled.

Reply via email to