Open whyrusleeping opened 6 years ago
cc @magik6k @Stebalien
Digging through the data there a few things I see:
dialLimiter.perPeerLimit
when there are dials to many unique peers
We should give LAN address dials lower timeout
Yeah, big +1 here. I honestly think 5s should be plenty here. What we really need is more granular timeouts. We need one timeout for the raw underlying 'connect' call, and then a slightly larger timeout for the crypto handshake part.
We should lower dialLimiter.perPeerLimit when there are dials to many unique peers
Yeah, this is a good idea. We will have to come up with a good heuristic here, but it should be pretty simple to do.
So I just realized that there may be another problem:
Example:
This is another thing fixable by making timeouts more granular / smarter
Damn. Yeah, that dial timeout is in the wrong place. It should be per connection.
However, moving the dial timeout may make things worse: a single peer with a ton of addresses could clog the dialer forever.
So, we may need two (max time dialing a single peer, max time per connection).
However, moving the dial timeout may make things worse: a single peer with a ton of addresses could clog the dialer forever.
Not really as we allow only 8 concurrent dial per peer at a time, but yeah, it's still an issue
So, we may need two (max time dialing a single peer, max time per connection).
Status: We now have this.
@whyrusleeping It's possible that in your second example there was 1 or more dials parked by the limiter due to FD limits being exceeded. Not sure where the tracing kicks in in your logging gadget, but if it's when the dial is actually inflight, that would explain why the trace was 1min long but it only contained two adjacent ~0.5ms spans.
So this isnt necessarily an implementation bug, but rather a design bug. While investigating connectivity issues i put together a log scraper coalescer thingy that gathers information about each overall dial attempt and each of its individual dials. The full log is here, and should be pretty interesting for anyone who cares about dials.
I'm making this issue because I see a lot of dials like this one:
Where the overall dial takes about 30 seconds, but the sum of the dials involved take only ~3.5s.
Then theres also this one:
Where the overall dial operation takes a full minute, but only contains two dials, each of which took ~0 time.