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

Less aggressive peer discovery #5747

Merged
merged 1 commit into from
Jun 1, 2023
Merged

Less aggressive peer discovery #5747

merged 1 commit into from
Jun 1, 2023

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Jun 1, 2023

Changes

When the number of connected Peers is not at max (fairly common) and the Peer's db is fairly mature; the reconnection will accesses the NodeStatsManager's nodeStats ConcurrentDictionary more frequently than the VM calls UpdateGas (which is every op executed)

image

  • Cache hashcode in Node
  • Replace locking in NodeStatsLight with Volatile.Read and Interlocked.Increment
  • Stop NodeStatsManager timer running while executing
  • Cache INodeStats object in Peer rather than looking it up from ConcurrentDictionary on each method call
  • Throttle PeerManager if in a hot discovery loop; by up to 50ms per set of candidates

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

@benaadams benaadams marked this pull request as ready for review June 1, 2023 02:02
@asdacap
Copy link
Contributor

asdacap commented Jun 1, 2023

Whoa its called that much!?

@benaadams benaadams merged commit 9352a78 into master Jun 1, 2023
@benaadams benaadams deleted the Peer-Discovery branch June 1, 2023 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants