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

feat: Modify grpc gateway to be concurrent (backport #11234) #11536

Closed
wants to merge 5 commits into from

Conversation

mergify[bot]
Copy link
Contributor

@mergify mergify bot commented Apr 4, 2022

This is an automatic backport of pull request #11234 done by Mergify.
Cherry-pick of 5356a86 has failed:

On branch mergify/bp/release/v0.45.x/pr-11234
Your branch is up to date with 'origin/release/v0.45.x'.

You are currently cherry-picking commit 5356a8682.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   server/start.go

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   CHANGELOG.md
	both modified:   client/context.go
	both modified:   client/grpc_query.go

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/github/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally


Mergify commands and options

More conditions and actions can be found in the documentation.

You can also trigger Mergify actions by commenting on this pull request:

  • @Mergifyio refresh will re-evaluate the rules
  • @Mergifyio rebase will rebase this PR on its base branch
  • @Mergifyio update will merge the base branch into this PR
  • @Mergifyio backport <destination> will backport this PR on <destination> branch

Additionally, on Mergify dashboard you can:

  • look at your merge queues
  • generate the Mergify configuration with the config editor.

Finally, you can contact us on https://mergify.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:
- 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
server/start.go Outdated Show resolved Hide resolved
@tac0turtle tac0turtle mentioned this pull request Apr 5, 2022
20 tasks
Copy link
Contributor

@amaury1093 amaury1093 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember there were some data race issues we discovered when enabling this. Were they all solved/tested?

server/start.go Outdated Show resolved Hide resolved
server/start.go Outdated Show resolved Hide resolved
if err != nil {
return err
}
grpcAddress := fmt.Sprintf("127.0.0.1:%s", port)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config.GRPC.Address specifies both host and port, but here you force host to 127.0.0.1 in the address which you dial. If the configured address isn't reachable via that IP, will this break?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you cannot reach 127.0.0.1, yes, this would not work. But this isn't the original PR, so I'm not sure why this was needed.

cc @Thunnini

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you cannot reach 127.0.0.1, yes, this would not work.

I guess I'm asking about the situation where the gRPC address was set to a non-localhost IP. For example, if you have a host with a network interface that has a [public] IP of 1.2.3.4 you can bind a listener to that IP and it won't be reachable via 127.0.0.1.

@amaury1093 amaury1093 self-assigned this Apr 6, 2022
@github-actions
Copy link
Contributor

This pull request has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@github-actions github-actions bot added the stale label May 22, 2022
@tac0turtle
Copy link
Member

with 0.46 around the corner we can close this

@tac0turtle tac0turtle closed this May 23, 2022
@tac0turtle tac0turtle deleted the mergify/bp/release/v0.45.x/pr-11234 branch May 23, 2022 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants