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

Reduce datetime calls in peer discovery by factor of 100 #5751

Merged
merged 13 commits into from
Jun 3, 2023

Conversation

benaadams
Copy link
Member

@benaadams benaadams commented Jun 1, 2023

Changes

  • Reduce calls to DateTime.UtcNow by factor of 100 (e.g. 3M -> 30k)
  • After going through 1k peers for discovery wait TIME_WAIT before continuing to allow sockets to clear
  • After going through all previously known peers for discovery wait TIME_WAIT before starting again to allow sockets to clear
  • NetworkStorage: HashSet<PublicKey>+List<NetworkNode> -> Dictionary<PublicKey, NetworkNode>

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 mentioned this pull request Jun 1, 2023
12 tasks
@benaadams benaadams requested a review from LukaszRozmej June 1, 2023 12:05
@benaadams benaadams marked this pull request as ready for review June 1, 2023 12:11
@benaadams benaadams changed the title Peer discovery tweak Reduce time calls in peer discovery by factor of 100 Jun 2, 2023
@benaadams benaadams changed the title Reduce time calls in peer discovery by factor of 100 Reduce datetime calls in peer discovery by factor of 100 Jun 2, 2023
@LukaszRozmej
Copy link
Member

Can you provide some metrics or profiling how it affected peer management?

@benaadams
Copy link
Member Author

benaadams commented Jun 3, 2023

Before (last column)

image

After

image
image

@benaadams benaadams merged commit b07ac24 into master Jun 3, 2023
@benaadams benaadams deleted the Peer-Discovery-tweak branch June 3, 2023 03:36
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.

2 participants