teamnsrg / ethereum-p2p

Official Go implementation of the Ethereum protocol
https://geth.ethereum.org
GNU Lesser General Public License v3.0
17 stars 9 forks source link

manspreading - p2p proxy #27

Open SimonSK opened 6 years ago

SimonSK commented 6 years ago

https://github.com/xiaoyao1991/manspreading

Xiaoyao's manspreading seems like what we need to efficiently maintain a large number of peer connections. I think we could implement this into our current node-finder and run only a small number (possibly only 1) eth-monitor behind it.

The current node-finder disconnects peers as soon as we learn about their info. I'm thinking, with the proxy feature, we let the node-finder keep p2p connections and continue relaying eth subprotocol messages to the eth-monitor, if online.

This would accomplish followings:

  1. Most of the resource heavy tasks occur on the eth subprotocol. Having node-finder maintain p2p connections won’t have much impact on its resource usage as the heavy-lifting is really done by eth-monitor.
  2. eth-monitor communicates with only manspreading/node-finder instance(s), greatly reducing its resource usage.
  3. This eliminates aggressive p2p connection attempts of eth-monitor, which is also redundant as the node-finder already does this when gathering node info.
  4. This solves the problem of potentially losing all peers when eth-monitor goes down due to some fatal error.