-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
feat: Modify grpc gateway to be concurrent #11234
feat: Modify grpc gateway to be concurrent #11234
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
utACK.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's implement this as a:
switch ctx.GRPCClient {
case nil:
abci query
default:
grpc query
}
This makes code more readable.
@Thunnini any chance you can update the code and then we can get this merged? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Love it.
"google.golang.org/grpc" | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"google.golang.org/grpc" | |
"google.golang.org/grpc" |
@marbar3778 Srry things got delayed, I was out bc of covid 😥 Updated reflecting the reviews!
|
@Mergifyio backport release/v0.45.x |
✅ Backports have been created
|
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. The code base has the following changes: - GRPCClient field has been added to Client Context. - The `Invoke` method in Client Context would use ABCI query when GRPCClient field is set to nil, otherwise use the GRPC Client to return results that have used grpc. - If GRPC is set to enable in `startInProcess`, it sets the GRPC Client field in Client Context. (cherry picked from commit 5356a86) # Conflicts: # CHANGELOG.md # client/context.go # client/grpc_query.go
Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234).
* Problem: grpc query is not run concurrently Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234). * Update CHANGELOG.md * Update CHANGELOG.md * Update server/start.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * wrap error * Update server/start.go * more complete copy * fix grpc crash Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
* Problem: grpc query is not run concurrently Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234). * Update CHANGELOG.md * Update CHANGELOG.md * Update server/start.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * wrap error * Update server/start.go * more complete copy * fix grpc crash Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
* Problem: grpc query is not run concurrently Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234). * Update CHANGELOG.md * Update CHANGELOG.md * Update server/start.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * wrap error * Update server/start.go * more complete copy * fix grpc crash Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
* Problem: grpc query is not run concurrently Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234). * Update CHANGELOG.md * Update CHANGELOG.md * Update server/start.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * wrap error * Update server/start.go * more complete copy * fix grpc crash Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
* Problem: grpc query is not run concurrently Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234). * Update CHANGELOG.md * Update CHANGELOG.md * Update server/start.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * wrap error * Update server/start.go * more complete copy * fix grpc crash Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
* Problem: grpc query is not run concurrently Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234). * Update CHANGELOG.md * Update CHANGELOG.md * Update server/start.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * wrap error * Update server/start.go * more complete copy * fix grpc crash Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
* Problem: grpc query is not run concurrently Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234). * Update CHANGELOG.md * Update CHANGELOG.md * Update server/start.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * wrap error * Update server/start.go * more complete copy * fix grpc crash Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> (cherry picked from commit 6574019)
* Problem: grpc query is not run concurrently Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234). * Update CHANGELOG.md * Update CHANGELOG.md * Update server/start.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * wrap error * Update server/start.go * more complete copy * fix grpc crash Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
* Problem: grpc query is not run concurrently Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234). * Update CHANGELOG.md * Update CHANGELOG.md * Update server/start.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * wrap error * Update server/start.go * more complete copy * fix grpc crash Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
* Problem: grpc query is not run concurrently Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234). * Update CHANGELOG.md * Update CHANGELOG.md * Update server/start.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * wrap error * Update server/start.go * more complete copy * fix grpc crash Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
* Problem: grpc query is not run concurrently Solution: - Initiate the GRPCClient introduced in [sdk 0.46](cosmos/cosmos-sdk#11234). * Update CHANGELOG.md * Update CHANGELOG.md * Update server/start.go Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com> * wrap error * Update server/start.go * more complete copy * fix grpc crash Co-authored-by: Federico Kunze Küllmer <31522760+fedekunze@users.noreply.github.com>
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.
The code base has the following changes:
Invoke
method in Client Context would use ABCI query when GRPCClient field is set to nil, otherwise use the GRPC Client to return results that have used grpc.startInProcess
, it sets the GRPC Client field in Client Context.