@Benchmark
    @OperationsPerInvocation(TIMES)
    public void testConcurrentHashMapEntrySet(Blackhole blackhole) {
        for (int i = 0; i < TIMES; i++) {
            if (i % writePerLoops == 0) {
                // add offset mapSize to ensure computeIfAbsent do add new entry
                concurrentHashMap.computeIfAbsent(i + mapSize, key -> key);
            } else {
                for (Map.Entry<Integer, Integer> entry : concurrentHashMap.entrySet()) {
                    blackhole.consume(entry);
                }
            }
        }
    }
This benchmark compares the performance of CopyOnWriteMap and ConcurrentHashMap
under a low-write scenario. We use computeIfAbsent as the write operation,
since it is the only CopyOnWriteMap write operation used in the code base and
constitutes 10% of the operations. The benchmark tests the performance of
get, values, and entrySet methods, as these methods are also used in the code.
jmh-benchmarks/src/main/java/org/apache/kafka/jmh/util/ConcurrentMapBenchmark.java