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

refactor: replace tokio lock with std lock in some sync scenarios #694

Merged
merged 2 commits into from
Mar 3, 2023

Conversation

ShiKaiWi
Copy link
Member

@ShiKaiWi ShiKaiWi commented Mar 3, 2023

Which issue does this PR close?

Closes #

Rationale for this change

The tokio lock has performance issues when hot contention occurs, which may leading to yielding by tokio runtime schedule. That is to say, we should use std lock if the critical section is short or doesn't run across await point.

And the api docs of tokio has made a explanation for the choice between tokio lock and std lock.

What changes are included in this PR?

  • Replace the tokio lock with std lock as much as possible.

Are there any user-facing changes?

None.

How does this change test

Existing tests.

Copy link
Contributor

@Rachelint Rachelint left a comment

Choose a reason for hiding this comment

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

LGTM

@ShiKaiWi ShiKaiWi added this pull request to the merge queue Mar 3, 2023
Merged via the queue into apache:main with commit a68c84c Mar 3, 2023
chunshao90 pushed a commit to chunshao90/ceresdb that referenced this pull request May 15, 2023
…ache#694)

* refactor: replace tokio lock with std lock in some sync scenarios

* fix: clippy warnings
@ShiKaiWi ShiKaiWi deleted the fix-replace-tokio-lock branch May 29, 2023 08:35
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.

None yet

2 participants