Why so long to connect with known peers?

When I initialize a new IPFS node (go IPFS) and add a peering section with 4 known and longstanding peers to the config file, shouldn’t that more or less establish a direct route to those peers?

Rather, it takes minutes (sometimes many!) to make a connection. I added the peers to shorten node discovery for key servers.

Aside from going with IPFS cluster, is there a faster way to establish a link between known nodes?

I’ve also seen that ipfs ping fails to work.

As I just explained on another post, peering only works well if both sides do it. On the other hand, if many people (nodes) try to peer with known servers and those servers are unaware of it, you basically bring down the server and nothing works anymore.

Peering

Hang on, so this is a DDoS vector?

Kinda, it depends on the numbers. Let me try to explain this:

In order for a server to do its job, it needs to manage its connection pool. It needs to be able to discard connections that aren’t useful to it so that it can open transient connections to other nodes that are useful to the requests it’s working on. This is a very dynamic process. It also accepts transient connections from other nodes looking for things, but those are discarded fairly quickly as well, as they are not useful to what it’s doing.

Now, your node dials the server and sits there. The server asks, would you like anything? and you answer, no I just wanna hang. Bye. It hangs up. The problem is, you dial right back and pull the same stunt. Now, if it’s just you, you’re an annoyance. But, imagine we are talking about a well known server, like ipfs.io (dweb.link), and everybody and his brother thinks he’s oh so clever and will establish an asymmetric peering with that server to improve their situation. Well, none of those connections are useful, so the server tries to get rid of them, only to get redialed immediately. If you have enough of those, they begin to behave like a botnet trying to take down the server.

This is why I advised to only establish symmetric peering, where both sides agree to keep the connection open at all times. No constant churn. And they both agree they are useful to each other.

1 Like