livepeer / livepeer/go-livepeer
Optimize fetching transcoder pool
@RiccardoBiosas is already working on this.
Since Mar 18, 2022.
- Dominant language
- Go
- Stars
- 586
- Forks
- 226
- Avg merge
- 1d 17h
- Merged PRs (30d)
- 19
Description
Livepeer fetches all active orchestrators from the chain. It happens in the function TranscoderPool(), which is called in a number of scenarios:
- during the node startup
- before initializing the round
- during calling reward
- while using webserver by Livepeer CLI (here and in other places)
Fetching orchestrators happens sequentially. Each transcoder is fetched by calling the on-chain contract function GetNextTranscoderInPool(). This process already takes almost 2 min and it will grow linearly together with the number of active orchestrators.
We need to research and implement an optimization to this process. Some first ideas:
- Use Subgraph with indexed chain data
- Create a smart contract which stores the orchestrator pool on-chain
- Cache active orchestrator pool in the local DB
I suggest to first research the domain of solutions, describe and review them, and when we agree on the solution, finally do the actual implementation.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.