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

Removes usage of ConcurrentHashMap in LocalXAResource.java to avoid thread pinning in JDKs of version 22 and lower #8900

Merged
merged 1 commit into from
Jun 21, 2024

Conversation

ljnelson
Copy link
Member

This PR removes usage of the java.util.concurrent.ConcurrentHashMap class in LocalXAResource to avoid thread pinning issues (ConcurrentHashMap uses synchronized internally, and association computation involves IO).

This initial revision of this PR is as simple as can be at the possible expense of too coarse a lock, serializing all access to the associations Map through a single ReentrantLock.

In the normal JTA course of events this should probably be fine? It is worth bearing in mind that a JTA implementation can conceivably perform any association-mutating operation on a given thread-specific transaction branch from any thread, which makes things tricky.

Because of that, I plan to immediately and subsequently explore doing this in a more performant way in a subsequent revision, but this PR will exist so that if it is deemed necessary to push it as-is we can do so. I don't know offhand whether this will help or hurt overall performance.

…hread pinning in JDKs of version 22 and lower

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
@ljnelson ljnelson added P3 jpa/jta performance java Pull requests that update Java code 4.x Version 4.x labels Jun 20, 2024
@ljnelson ljnelson requested a review from spericas June 20, 2024 20:16
@ljnelson ljnelson self-assigned this Jun 20, 2024
@oracle-contributor-agreement oracle-contributor-agreement bot added the OCA Verified All contributors have signed the Oracle Contributor Agreement. label Jun 20, 2024
Copy link
Member

@spericas spericas left a comment

Choose a reason for hiding this comment

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

LGTM

@ljnelson ljnelson merged commit d5f8d58 into helidon-io:main Jun 21, 2024
12 checks passed
@ljnelson ljnelson added this to the 4.1.0 milestone Jun 21, 2024
barchetta pushed a commit to barchetta/helidon that referenced this pull request Jul 15, 2024
…hread pinning in JDKs of version 22 and lower (helidon-io#8900)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
barchetta added a commit that referenced this pull request Jul 15, 2024
…hread pinning in JDKs of version 22 and lower (#8900) (#8988)

Signed-off-by: Laird Nelson <laird.nelson@oracle.com>
Co-authored-by: Laird Nelson <laird.nelson@oracle.com>
@vasanth-bhat
Copy link

We have tested the fix with one of the Spectra Service , and we no longer see pinning on this stack , with the fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4.x Version 4.x java Pull requests that update Java code jpa/jta OCA Verified All contributors have signed the Oracle Contributor Agreement. P3 performance
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

Platform pinning observed, potentially, indirectly caused by Helidon MP framework code (JTA)
3 participants