Skip to content
This repository has been archived by the owner on Apr 4, 2024. It is now read-only.

Problem: slow queries can slow down consensus state machine #1007

Closed
yihuang opened this issue Mar 21, 2022 · 6 comments · Fixed by #1352
Closed

Problem: slow queries can slow down consensus state machine #1007

yihuang opened this issue Mar 21, 2022 · 6 comments · Fixed by #1352

Comments

@yihuang
Copy link
Contributor

yihuang commented Mar 21, 2022

Proposal: Make the query runs concurrently with the consensus state machine

Current behavior: slow queries can block consensus execution and cause the node to lag behind,

Desired behavior: Query should be handled concurrently with consensus.

Use case:

Fix the lag behind issue in RPC nodes.

@yihuang
Copy link
Contributor Author

yihuang commented Apr 4, 2022

cosmos/cosmos-sdk#10997
could use grpc client to query.

@github-actions
Copy link

This issue is stale because it has been open 45 days with no activity. Remove Status: Stale label or comment or this will be closed in 7 days.

@adu-crypto
Copy link
Contributor

it seems concurrent grpc gatewy is solved by this PR?

Current grpc happens to be concurrent, while the grpc gateway itself is not, since it always uses abci query. Therefore, as the current queries are not concurrent, throughput has the room for improvement. This PR changes the grpc gateway so that when server is ran by a node daemon, it directly calls grpc to make queries concurrent. Any services that uses grpc gateway could improve throughput by fundamental amount, which has been tested and ensured in the process of running an Osmosis node using the current chagnes.

@yihuang
Copy link
Contributor Author

yihuang commented Jun 3, 2022

it seems concurrent grpc gatewy is solved by this PR?

Current grpc happens to be concurrent, while the grpc gateway itself is not, since it always uses abci query. Therefore, as the current queries are not concurrent, throughput has the room for improvement. This PR changes the grpc gateway so that when server is ran by a node daemon, it directly calls grpc to make queries concurrent. Any services that uses grpc gateway could improve throughput by fundamental amount, which has been tested and ensured in the process of running an Osmosis node using the current chagnes.

Yeah, but ethermint json-rpc don't use the grpc apis directly, but through the abci client

@adu-crypto
Copy link
Contributor

I think the cosmos-sdk pr of using gRPC for queries got stuck because there is race condition in state, so maybe the possible solution is to add Mutex or RWMutex in state?

@github-actions
Copy link

This issue is stale because it has been open 45 days with no activity. Remove Status: Stale label or comment or this will be closed in 7 days.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants