-
Notifications
You must be signed in to change notification settings - Fork 992
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 checking for p2p connection limits (revised) #2993
improve checking for p2p connection limits (revised) #2993
Conversation
…2p_connections_investigation
…t to keep the peer address queue drained but actually attempt a healthy number of connections as most of these attempts are going to fail due to majority of nodes not being publicly accessible
My issue cleared up locally when I reverted fb9b06e still doing some more testing |
We were originally taking max peers (125) each time off the address queue and attempting to connect to them.
#2985 modified this to only take max outbound peers (8) each time.
So every 30s we were only attempting to connect to 8 new peers, with a high possibility that all or most of those were not publicly accessible. This is why initial seeding sometimes failed completely and why it seems to be slower to get new peer connections. This revised PR relaxes this rule and simply takes a max of 128 new peer addresses each loop, regardless of the inbound/outbound limits.
Testing seems to indicate this is significantly faster at filling up the default 8 outbound slots as we have a reasonable chance of finding publicly accessible nodes every loop now. We also have a far more reliable initial seeding as we allow our node to attempt to connect to all the seeds up front. |
This config seems to be pretty stable behind a firewall, with my node looking (and finding a couple of new ones) for publicly accessible peers every 30s -
Takes a few minutes but its churning through the full set of peers in the db, marking large numbers as
Got to our preferred 32 outbound eventually, 3702 defunct along the way -
And restarting the node connects successfully to at least 32 outbound connections quickly, within a few seconds -
|
Replacement PR for #2985 which we reverted in 17dddee
Tweaked the limit in terms of how many peer connections we attempt regardless of our desired outbound connections.
The key point here is the vast majority of our peer addresses in the db are not publicly accessible.
So if we only try a random 8 then we stand a good chance of failing to connect to any new ones.
This is particularly important during the initial seed step on node startup - we want to try all the seeds retrieved via dns, not just 8 of them. If these 8 fail for any reason then we end up stuck with our node not making any further attempts.