Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

节点最大连接数MaxPeers的默认值小于最大共识节点连接数MaxConsensusPeers的默认值 #1791

Closed
niuxiaojie81 opened this issue Jun 5, 2021 · 5 comments
Assignees
Labels
feature New feature or request Fixed

Comments

@niuxiaojie81
Copy link
Contributor

niuxiaojie81 commented Jun 5, 2021

MaxPeers 默认值为50,MaxConsensusPeers 默认值为100。

MaxPeers: 50,

然而,在节点建立连接,握手检查过程中,存在以下逻辑:

if srv.consensus && len(peers) >= srv.MaxPeers && c.is(consensusDialedConn) {

可以看出,MaxPeers “包含”了 MaxConsensusPeers,所以节点在实际运行中,节点连接数一直受 MaxPeers 的上限影响。

建议将 MaxPeers 默认值修改为100.

@benbaley benbaley added the feature New feature or request label Jun 5, 2021
@benbaley
Copy link
Member

benbaley commented Jun 5, 2021

ACK

@niuxiaojie81
Copy link
Contributor Author

Alaya 网络 MaxPeers 默认值修改为80.

@benbaley
Copy link
Member

限制最大连接数,要考虑后续扩容后,共识节点超过最大连接数,共识节点尝试直连可能会导致其他节点连不上共识节点

@niuxiaojie81
Copy link
Contributor Author

修改后的逻辑:
1、MaxPeers包含了MaxConsensusPeers,即MaxPeers的设置必须大于MaxConsensusPeers
2、共识节点连接数超过了MaxConsensusPeers设置,一律不允许再添加consensusDialedConn
3、共识节点连接数没有超过MaxConsensusPeers设置,但连接总数超过了MaxPeers设置
当前节点是共识节点:断开一个非consensusDialedConn,并允许请求的consensusDialedConn连接(一断一连保持不超过MaxPeers)
当前节点不是共识节点:不允许连接
4、trustedConn、staticDialedConn连接不受MaxPeers限制
5、MaxPeers默认值60,MaxConsensusPeers默认值40

@benbaley benbaley added the Fixed label Jul 6, 2021
@benbaley
Copy link
Member

close by done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request Fixed
Projects
None yet
Development

No branches or pull requests

2 participants