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

[chain-co] Achieving the fastest request API in nodes with the same optimal block height / 在最优区块高度相同的节点中做到最快速请求api #5907

Open
11 tasks
simlecode opened this issue Apr 17, 2023 · 4 comments
Labels
C-enhancement Category: feature enhancement P3 Low - not important right now

Comments

@simlecode
Copy link
Collaborator

simlecode commented Apr 17, 2023

链服务模块 / Chain Service Components

  • venus
  • venus-auth
  • venus-gateway
  • venus-messager
  • venus-miner
  • 文档 / docs

订单服务模块 / Deal Service Components

  • venus-market
  • 文档 / docs

算力服务模块 / Storage Power Service Components

  • venus-sector-manager
  • venus-worker
  • 文档 / docs

描述 / Description

venus-miner 请求一些接口的耗时比较高,目前想通过请求多个节点的同一接口,找到耗时最短的请求,然后把其作为结果返回

@simlecode simlecode added the C-enhancement Category: feature enhancement label Apr 17, 2023
@diwufeiwen
Copy link
Contributor

diwufeiwen commented Apr 17, 2023

现在的情形是这样的,假设chain-co选择最优节点时有3个节点都正在计算链的新状态,距离计算完成剩余时间分别为:5s,10s,3s; 目前的逻辑并不能做到请求剩余时间最少的同步节点API. 如果选择了剩余10s的节点,会导致API耗时很久,影响正常的业务,如出块的某些接口:MinerGetBaseInfo,MinerCreateBlock,MpoolSelects

@diwufeiwen diwufeiwen added the P2 Medium - we should get to this soon label Apr 17, 2023
@diwufeiwen
Copy link
Contributor

diwufeiwen commented Apr 17, 2023

第一个参考设计: (2) chain-co选择最优节点时,如果有多个节点同步高度相同,则全部记录,不是从中随机选一个作为最优; (2) 对需要状态计算完成才可以返回的接口,多线程调用最优列表中节点的API,返回第一个请求到的结果.

@diwufeiwen
Copy link
Contributor

diwufeiwen commented May 29, 2023

假设chain-co有3个同步节点,高度和同步新区块剩余时间分别为:

高度 同步区块剩余时间
100 10s
100 2s
99 0s

在这种情形下,chain-co选择最优节点大概率会是第一个,部分API需要等待最新区块同步完成,故耗时很久,如选择消息,请求BaseInfo等接口。

@diwufeiwen diwufeiwen added P3 Low - not important right now and removed P2 Medium - we should get to this soon labels May 29, 2023
@simlecode
Copy link
Collaborator Author

miner 连接 chain-co,chain-co下面有多个节点,节点的状态不一致,miner 提交新的区块到节点时,可能会遇到区块找不到,或者消息找不到的问题,目前可以通过给 SubmitNodes 配置多个节点来缓解这个问题。chain-co 后续考虑 SyncSubmitBlock 接口向连接的全部节点广播?

miner

miner_log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category: feature enhancement P3 Low - not important right now
Projects
Status: No status
Development

No branches or pull requests

2 participants