Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KAFKA-17023: add PCollectionsImmutableMap to ConcurrentMapBenchmark #16425

Open
wants to merge 7 commits into
base: trunk
Choose a base branch
from

Conversation

TaiJuWu
Copy link
Contributor

@TaiJuWu TaiJuWu commented Jun 22, 2024

*More detailed description of your change,
Add SingleWriteMultiReadBenchmark for ConcurrentHashMap, CopyOnWriteMap, PcollectionsImmutableMap

Running Command:
./jmh-benchmarks/jmh.sh org.apache.kafka.jmh.util.SingleWriteMultiReadBenchmar

Test result:

Benchmark                                                                                     (mapSize)  (writePercentage)  Mode  Cnt      Score       Error  Units
SingleWriteMultiReadBenchmark.ConcurrentHashMap                                                     100                0.1  avgt    5   5551.856 ±  5184.034  ns/op
SingleWriteMultiReadBenchmark.ConcurrentHashMap:testConcurrentHashMapEntry                          100                0.1  avgt    5  12631.454 ± 11665.343  ns/op
SingleWriteMultiReadBenchmark.ConcurrentHashMap:testConcurrentHashMapGet                            100                0.1  avgt    5     50.020 ±    51.794  ns/op
SingleWriteMultiReadBenchmark.ConcurrentHashMap:testConcurrentHashMapRandomGet                      100                0.1  avgt    5     82.140 ±   111.144  ns/op
SingleWriteMultiReadBenchmark.ConcurrentHashMap:testConcurrentHashMapValues                         100                0.1  avgt    5   9998.994 ±  9485.352  ns/op
SingleWriteMultiReadBenchmark.ConcurrentHashMap:testConcurrentHashMapWrite                          100                0.1  avgt    5     ≈ 10⁻⁴              ns/op
SingleWriteMultiReadBenchmark.CopyOnWriteMap                                                        100                0.1  avgt    5   3571.190 ±  2335.478  ns/op
SingleWriteMultiReadBenchmark.CopyOnWriteMap:testCopyOnWriteMapEntry                                100                0.1  avgt    5   8741.245 ±  5825.625  ns/op
SingleWriteMultiReadBenchmark.CopyOnWriteMap:testCopyOnWriteMapGet                                  100                0.1  avgt    5     43.997 ±    27.091  ns/op
SingleWriteMultiReadBenchmark.CopyOnWriteMap:testCopyOnWriteMapRandomGet                            100                0.1  avgt    5     72.952 ±    69.792  ns/op
SingleWriteMultiReadBenchmark.CopyOnWriteMap:testCopyOnWriteMapValues                               100                0.1  avgt    5   5783.686 ±  3656.257  ns/op
SingleWriteMultiReadBenchmark.CopyOnWriteMap:testCopyOnWriteMapWrite                                100                0.1  avgt    5      0.001 ±     0.008  ns/op
SingleWriteMultiReadBenchmark.PcollectionsImmutableMap                                              100                0.1  avgt    5   5529.729 ±  1322.872  ns/op
SingleWriteMultiReadBenchmark.PcollectionsImmutableMap:testPcollectionsImmutableMapEntry            100                0.1  avgt    5   9151.719 ±  3652.206  ns/op
SingleWriteMultiReadBenchmark.PcollectionsImmutableMap:testPcollectionsImmutableMapGet              100                0.1  avgt    5    202.152 ±    85.313  ns/op
SingleWriteMultiReadBenchmark.PcollectionsImmutableMap:testPcollectionsImmutableMapRandomGet        100                0.1  avgt    5    320.565 ±    89.311  ns/op
SingleWriteMultiReadBenchmark.PcollectionsImmutableMap:testPcollectionsImmutableMapValues           100                0.1  avgt    5  12997.451 ±  2356.417  ns/op
SingleWriteMultiReadBenchmark.PcollectionsImmutableMap:testPcollectionsImmutableMapWrite            100                0.1  avgt    5      0.001 ±     0.004  ns/op

*Summary of testing strategy (including rationale)

Committer Checklist (excluded from commit message)

  • Verify design and implementation
  • Verify test coverage and CI build status
  • Verify documentation (including upgrade notes)

Copy link
Contributor

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TaiJuWu thanks for patch!

@TaiJuWu TaiJuWu force-pushed the PCollectionsImmutableMap branch 2 times, most recently from ec8dede to 55f7797 Compare June 24, 2024 14:49
Copy link
Contributor

@chia7712 chia7712 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@TaiJuWu thanks for this benchmark

@chia7712
Copy link
Contributor

@TaiJuWu It seems copyOnWrite has better performance overall?

@TaiJuWu
Copy link
Contributor Author

TaiJuWu commented Jun 26, 2024

@TaiJuWu It seems copyOnWrite has better performance overall?

Yes, using copyOnWrite can get better performance than others according the benchmark.

@chia7712
Copy link
Contributor

Yes, using copyOnWrite can get better performance than others according the benchmark.

please take a look at the use case of acl cache. that will be a good start

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants