libp2p / js-libp2p-kad-dht

JavaScript implementation of the DHT for libp2p
https://libp2p.io
Other
141 stars 60 forks source link

Discovered too many peers? #61

Open alanshaw opened 5 years ago

alanshaw commented 5 years ago
screenshot 2018-12-10 at 14 37 50

I mean, this is 😎, but I don't think there's that many peers on the network. At this same time my go-ipfs node was settling on ~800 nodes.

lidel commented 5 years ago

Companion just counts the number of entries returned by ipfs.swarm.peers() :) I think 3k peers will really happen if you disable connection manager in go-ipfs.

So my guess is that either:

Excerpt from release notes of go-ipfs v0.4.12:

The most critical change is the 'Connection Manager': it allows an ipfs node to maintain a limited set of connections to other peers in the network. By default (and with no config changes required by the user), ipfs nodes will now try to maintain between 600 and 900 open connections. These limits are still likely higher than needed, and future releases may lower the default recommendation, but for now we want to make changes gradually. The rationale for this selection of numbers is as follows:

  • The DHT routing table for a large network may rise to around 400 peers
  • Bitswap connections tend to be separate from the DHT
  • PubSub connections also generally are another distinct set of peers (including js-ipfs nodes)

Because of this, we selected 600 as a LowWater number, and 900 as a HighWater number to avoid having to clear out connections too frequently. You can configure different numbers as you see fit via the Swarm.ConnMgr field in your ipfs config file. See here for more details.

alanshaw commented 5 years ago

Incredible knowledge @lidel as usual ❤️

x5engine commented 5 years ago

I only have 35 peers come on! I need more like you!!!

vasco-santos commented 5 years ago

How are you testing this @x5engine ?