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

fix(libp2p): only dial one address at a time for peers #2028

Merged
merged 2 commits into from
Sep 8, 2023

Conversation

achingbrain
Copy link
Member

The observation for dialing is that for a given peer with multiple addresses, for a given class of address (e.g. public or private), either the first dial succeeds or they all fail, so there's not much point dialing all addresses together since in either case you waste resources either cancelling redundant dials or dialing addresses that fail.

We can't do much about dialing addresses that fail but we can reduce the number of redundant dials so with this change we only ever dial one multiaddr at a time.

Refs: #2010

The observation for dialing is that for a given peer with multiple
addresses, for a given class of address (e.g. public or private),
either the first dial succeeds or they all fail, so there's not
much point dialing all addresses together since in either case you
waste resources either cancelling redundant dials or dialing addresses
that fail.

We can't do much about dialing addresses that fail but we can
reduce the number of redundant dials so with this change we only ever
dial one multiaddr at a time.
@achingbrain achingbrain changed the title fix: only dial one address at a time for peers fix(libp2p): only dial one address at a time for peers Sep 8, 2023
@achingbrain achingbrain marked this pull request as ready for review September 8, 2023 10:24
Copy link
Member

@maschad maschad left a comment

Choose a reason for hiding this comment

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

I am not sure how this ensures we are only dialling one multiaddr at time, wouldn't there need to be some changes to the dial queue?

@achingbrain
Copy link
Member Author

wouldn't there need to be some changes to the dial queue?

No, we already have the ability to control how many parallel dials we do per peer as a parameter so all we need to do here is default it to 1.

@maschad
Copy link
Member

maschad commented Sep 8, 2023

I see, my understanding was that we would remove parallel dialling per peer all together, but this offers better flexibility.

@achingbrain achingbrain merged commit 73b87c5 into master Sep 8, 2023
18 checks passed
@achingbrain achingbrain deleted the fix/smarter-dialing branch September 8, 2023 15:41
This was referenced Jan 18, 2024
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