lodestar icon indicating copy to clipboard operation
lodestar copied to clipboard

libp2p peerstore prevents gaining peers fast

Open dapplion opened this issue 2 years ago • 4 comments

Describe the bug

Restarting a Lodestar beacon node after running for a while, it takes extremely long to gain peers to target_peers. We now that this doesn't happen on runs from scratch.

I did a test in two contabo nodes:

contabo-14: rm beacon/peer-id.json contabo-15: rm -r beacon/peerstore/

contabo-14: 2 min latter: 0 peers, 10 min latter 3 peers contabo-15: 2 min latter: 15 peers, 10 min latter 44 peers

Expected behavior

Having an existing peerstore should not delay gaining peers

Steps to Reproduce

  • Run Lodestar in Prater without peerstore and time 0 to target_peers (should be < 5 min)
  • Restart Lodestar and time 0 to target_peers (could be ~ 30 min)

contabo-14

Screenshot from 2022-03-03 15-27-46

contabo-15

Screenshot from 2022-03-03 15-28-10

dapplion avatar Mar 03 '22 09:03 dapplion

CC: @tuyennhv should we still go for https://github.com/ChainSafe/lodestar/compare/master...dapplion/ephemeral-peerid

dapplion avatar Mar 03 '22 09:03 dapplion

CC: @tuyennhv should we still go for master...dapplion/ephemeral-peerid

yeah I'm fine with creating new peer id upon restart (used to do that manually a lot of times), go ahead unless @wemeetagain has some information regarding discv5

twoeths avatar Mar 03 '22 10:03 twoeths

Should be fine

wemeetagain avatar Mar 03 '22 15:03 wemeetagain

Still observing this. The node appears to try to dial to the same peer over and over

dapplion avatar Jul 06 '22 14:07 dapplion

tested with v1.3.0/080b73b on a ctvpss node

1st time:

  • Remove peerstore, node gets to targetPeers in 22 minutes
  • Restart node, node gets to targetPeers in 9 minutes
  • Restart node, node gets to targetPeers in 12 minutes

2nd time:

  • Remove peerstore, node gets to targetPeers in 25 minutes
  • Restart node, node gets to targetPeers in 23 minutes
  • Restart node, node gets to targetPeers in 19 minutes

==> keeping peerstore even helps gaining peers a bit faster

Still observing this. The node appears to try to dial to the same peer over and over

fixed in https://github.com/ChainSafe/lodestar/pull/4969

twoeths avatar Jan 17 '23 06:01 twoeths