Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@cdvr1993
Copy link
Contributor

We have found that for java applications running on big machines (>8 cores) we start to see sudden spikes in latency. For instance a 32 core service gets a 100 ms spike which affect our p99.9.

By calling .get() before computeIfAbsent() we are able to reduce the impact of this (we can't completely remove it because we could still be allocating new keys).

We added a benchmark to demonstrate this. The 32 thread results are as follows:

Before the fix
Screenshot 2022-12-22 at 9 39 58 AM

After the fix
Screenshot 2022-12-22 at 9 53 03 AM

@CLAassistant
Copy link

CLAassistant commented Dec 22, 2022

CLA assistant check
All committers have signed the CLA.

Copy link
Collaborator

@SokolAndrey SokolAndrey left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Collaborator

Choose a reason for hiding this comment

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

i thought computeIfAbsent does exactly that. Strange that it makes a difference

@cdvr1993 cdvr1993 closed this Jan 9, 2023
@cdvr1993 cdvr1993 reopened this Jan 9, 2023
Copy link

Choose a reason for hiding this comment

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

nit: please remove

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done

@cdvr1993 cdvr1993 force-pushed the scope-lock-contention branch from 79a9e99 to 0a0f137 Compare January 9, 2023 23:43
@SokolAndrey SokolAndrey merged commit 5130e00 into uber-java:master Jan 18, 2023
sairamch04 pushed a commit to sairamch04/tally that referenced this pull request Feb 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants