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

Imp: Improve map access concurrency #739

Merged
merged 3 commits into from
Sep 9, 2020
Merged

Imp: Improve map access concurrency #739

merged 3 commits into from
Sep 9, 2020

Conversation

skyao
Copy link
Contributor

@skyao skyao commented Sep 7, 2020

What this PR does:

This PR is to improve the accessing of map in concurrency environment.

  1. improve the performace of GetURLStatus() method
  2. fix the problem of concurrency risk in GetMethodStatus() method

Which issue(s) this PR fixes:

Fixes #

Special notes for your reviewer:

Does this PR introduce a user-facing change?:

NONE

@zouyx
Copy link
Member

zouyx commented Sep 7, 2020

Should change target branch to deveop

@zouyx zouyx added help wanted Extra attention is needed improve Refactor or improve labels Sep 7, 2020
@zouyx zouyx added this to the 1.5.2 milestone Sep 7, 2020
@zouyx zouyx changed the base branch from master to develop September 7, 2020 04:34
Copy link
Member

@zouyx zouyx left a comment

Choose a reason for hiding this comment

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

Merge or rebase develop pls

@watermelo watermelo self-requested a review September 8, 2020 03:09
protocol/rpc_status.go Show resolved Hide resolved
Copy link
Contributor Author

@skyao skyao left a comment

Choose a reason for hiding this comment

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

The standard operation to access similar map:

  1. get with key, in most case it will return the stored one, make it AS FAST AS POSIBLE
  2. special case, if the key is not set, we should do initial and store it to map. We will do this only once, if no concurreny.
  3. More Special case, there are several thread access this NOT stored key, and all of them found the key is not set and should do initial and store, so we need to use LoadOrStore to avoid override the saved value.

protocol/rpc_status.go Show resolved Hide resolved
@zouyx zouyx merged commit fe8e2f8 into apache:develop Sep 9, 2020
zouyx added a commit to zouyx/dubbo-go that referenced this pull request Sep 22, 2020
AlexStocks pushed a commit that referenced this pull request Apr 14, 2021
kzhan pushed a commit to kzhan/dubbo-go that referenced this pull request Jun 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed improve Refactor or improve
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants