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

Explore gRPC queries concurrency #8591

Closed
4 tasks
amaury1093 opened this issue Feb 15, 2021 · 9 comments
Closed
4 tasks

Explore gRPC queries concurrency #8591

amaury1093 opened this issue Feb 15, 2021 · 9 comments
Labels
C: gRPC Issues and PRs related to the gRPC service and HTTP gateway.

Comments

@amaury1093
Copy link
Contributor

amaury1093 commented Feb 15, 2021

Summary

We should allow concurrent gRPC queries (state reads).

Problem Definition

After #8549, all gRPC queries are routed to the ABCI system. The current ABCI implementation uses global locks across all requests, so only one query can be processed at a time (also see abci notes).

Proposal

Explore how to have concurrent gRPC read queries.

Notes

cc @robert-zaremba @aaronc


For Admin Use

  • Not duplicate issue
  • Appropriate labels applied
  • Appropriate contributors tagged
  • Contributor assigned/self-assigned
@amaury1093 amaury1093 added the C: gRPC Issues and PRs related to the gRPC service and HTTP gateway. label Feb 15, 2021
@adasari
Copy link

adasari commented Feb 15, 2021

@robert-zaremba - not sure if it is right place to ask question. i looked into #8549 merge request, why is grpac-gateway is not used in first place to support both grpc and http end points ? which eliminates maintaining the mappings and return types by yourself.

Could you share more details about the ticket ? i will contribute if i understand the problem. thanks.

@danil-lashin
Copy link

danil-lashin commented Feb 16, 2021

As I see the only possible trouble happens when we trying to construct new ImmutableTree instance simultaneously with committing old one. So RWMutex in Store will be a simple and valid solution. I would be happy to make a PR if nobody mind.

@robert-zaremba
Copy link
Collaborator

@adasari - with current design all queries must go through ABCI, otherwise we have some subtle inconsistencies. ABCI is sequential, so it's a kind of a bottleneck.

@albertchon
Copy link
Contributor

albertchon commented Feb 18, 2021

Not sure if this is still relevant, but we've faced this issue in the past (fatal error: concurrent map read and map write) and @xlab made a quick fix by using wrapping the MutableTree in a RW mutex InjectiveLabs/iavl@df2d577

@ethanfrey
Copy link
Contributor

The current ABCI implementation uses global locks across all requests, so only one query can be processed at a time (also see abci notes).

This is by design. There are 3 connections between tendermint and the abci app (deliver, check, query) and each one is processed sequentially. However, the 3 can run in parallel.

In the app, each has access to a different state/store so this should avoid race conditions. We clearly cannot remove the lock for deliver and check, but it may be possible to do so with query. However, all app reasoning has been made in a sequential model, so this may introduce some race conditions down the line.

I know of no clear problem I can point at, but I would request involving the people that made the original design in such a discussion. Especially @ebuchman but maybe he can suggest more. Adding concurrency into a system designed with sequential execution in mind should not be taken lightly. Let's make sure it cannot introduce any subtle errors first

@fedekunze
Copy link
Collaborator

cc @sunnya97 @ValarDragon does ABCI++ architecture solve this?

@aaronc
Copy link
Member

aaronc commented Feb 26, 2021

cc @sunnya97 @ValarDragon does ABCI++ architecture solve this?

I'm pretty sure the issue is more about read write concurrency at the storage layer within the SDK. It should be fixed by upgrading our state storage layer which is in progress separately (#8430).

@ValarDragon
Copy link
Contributor

ValarDragon commented Feb 26, 2021

I don't think ABCI++ touches on this, its only dealing with how a single ABCI connection is used within consensus. This is more about managing distinct ABCI connections

@tac0turtle
Copy link
Member

closing this in favour of #10859. There is still something blocking parallel queries tho, outlined in the mentioned issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C: gRPC Issues and PRs related to the gRPC service and HTTP gateway.
Projects
None yet
Development

No branches or pull requests

10 participants