-
Notifications
You must be signed in to change notification settings - Fork 176
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
fix: speed up ConcurrentHashMap#computeIfAbsent of JDK8 #1245
Conversation
52d0c3f
to
3a060d1
Compare
Ping @andygrove. |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1245 +/- ##
============================================
- Coverage 34.69% 34.68% -0.01%
- Complexity 991 992 +1
============================================
Files 116 117 +1
Lines 44885 44895 +10
Branches 9863 9864 +1
============================================
+ Hits 15572 15574 +2
- Misses 26165 26172 +7
- Partials 3148 3149 +1 ☔ View full report in Codecov by Sentry. |
Thanks for the contribution, @SteNicholas, but I am not convinced this helps with performance. We only have a single use of taskIdMapsForShuffle.computeIfAbsent(handle.shuffleId, _ => new OpenHashSet[Long](16)) |
@andygrove, when using BTW, the JMH testing is as follows:
|
Thanks for raising this issue. I definitely learned something new about JDK8's performance issue with ConcurrentHashMap, as your microbenchmark demonstrates. However, it's not clear to me that the overall query performance will be meaningfully impacted by the amount of code being brought in to be maintained, and I'm not sure if we want to set a precedent for maintaining too many code paths for different JDK versions. |
@mbutrovich, is it better to close this pull request and reopen if needed? |
Personally, I think so. Also, do we want to continue supporting JDK8 for long (FWIW, redhat will support openjdk 8 till Nov 2026)? @andygrove, @kazuyukitanimura, @viirya wdyt? |
I would say that we should drop JDK 8 support if and when it becomes an effort to maintain (I'm not sure that it is at the moment?). I will go ahead and close this PR. Thanks @SteNicholas for making us aware of the issue. |
Which issue does this PR close?
Closes #1244.
Rationale for this change
Comet supports JDK8, which could meet the bug mentioned in JDK-8161372. Therefore, we could check the key existence before invoking
computeIfAbsent
.What changes are included in this PR?
Introduce
ConcurrentHashMapForJDK8
to check the key existence for speed up, which solves the bug JDK-8161372 to speed upConcurrentHashMap#computeIfAbsent
.Backport apache/incubator-uniffle#519.
How are these changes tested?
CI.