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

Improve observed address handling #585

Merged
merged 7 commits into from
Apr 9, 2019
Merged

Improve observed address handling #585

merged 7 commits into from
Apr 9, 2019

Conversation

vyzo
Copy link
Contributor

@vyzo vyzo commented Apr 9, 2019

Overhauls the observed address set to be more friendly to relays:

  • Optimizes the lock contention in Addrs, AddrsFor by stopping the eager clean up of expired entries
  • Adds a background worker for adding and gc'ing observed address, with a very short buffer

Closes #584

@ghost ghost assigned vyzo Apr 9, 2019
@ghost ghost added the status/in-progress In progress label Apr 9, 2019
@vyzo
Copy link
Contributor Author

vyzo commented Apr 9, 2019

I think we can improve further by using a read/write lock, as there is now a single writer and many readers.

Copy link
Member

@Stebalien Stebalien left a comment

Choose a reason for hiding this comment

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

LGTM. We may want to expose this information via an atomically updating snapshot but we can do that later.

oas := &ObservedAddrSet{
addrs: make(map[string][]*ObservedAddr),
ttl: pstore.OwnObservedAddrTTL,
wch: make(chan newObservation, 1),
Copy link
Member

Choose a reason for hiding this comment

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

Let's make this longer, like 64 or something (or at least 16). We want as many observed addrs as we can on initial start.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, will set to 16 (= 4 * activation-threshold)

@vyzo vyzo merged commit 7ae0fda into master Apr 9, 2019
@ghost ghost removed the status/in-progress In progress label Apr 9, 2019
@vyzo vyzo deleted the fix/obsaddr branch April 9, 2019 17:41
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.

2 participants