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

Review Rust gRPC ecosystem for Rust SDK #1300

Closed
markmandel opened this issue Jan 28, 2020 · 6 comments · Fixed by #2112
Closed

Review Rust gRPC ecosystem for Rust SDK #1300

markmandel opened this issue Jan 28, 2020 · 6 comments · Fixed by #2112
Labels
area/build-tools Development tooling. I.e. pretty much everything in the `build` directory. area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc good first issue These are great first issues. If you are looking for a place to start, start here! help wanted We would love help on these issues. Please come help us! kind/breaking Breaking change kind/feature New features for Agones
Milestone

Comments

@markmandel
Copy link
Collaborator

Context:
#1202 (comment)

The current Rust gRPC library has some issues around SSL, and the Rust ecosystem has changed a bit in the last while. We should review it, and see if it's worth switching out the underlying gRPC implementation -- without changing the Agones client SDK surface.

https://github.com/hyperium/tonic is looking like a forerunner from all reports, but apparently we might want to wait for a 0.2 release for the api surface to stabilise.

@markmandel markmandel added help wanted We would love help on these issues. Please come help us! good first issue These are great first issues. If you are looking for a place to start, start here! area/build-tools Development tooling. I.e. pretty much everything in the `build` directory. area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc labels Jan 28, 2020
@Jake-Shadle
Copy link
Contributor

Sorry for jumping the gun with #2112, I hadn't seen this issue before I started that work. Anyways, here are the pros/cons of switching from grpcio to tonic, as I see them.

Pros

  • Tonic is rust native, meaning there are no additional dependencies beyond cargo/rustc needed to build the rust sdk now (no cmake, no go)
  • While there is some C/asm code that will be compiled if TLS features are enabled, tonic uses rustls for its TLS implementation so there is no annoying dependency on openssl, making it easier to cross compile.
  • Tonic is part of the tokio ecosystem, which is the "standard" async runtime in the the wider rust ecosystem, meaning the rust sdk will now generally slot in to people's projects more seamlessly, rather than adding an additional GRPC/network stack to their application
  • Rust code is generated from protocols at buildtime and not checked in, which means it's generally easier to consume and make contributions to

Cons

  • Rust code is generated from protocols at buildtime and not checked in, which requires additional build dependencies like prost-build which are quite heavy, and requires the protocol files be copied adjacent to the rust sdk as cargo won't allow packaging crates from files above the cargo manifest directory
  • Tonic is async only, so you need to wrap sdk method calls in other code if you want to call them from a non-async context
  • Tonic clients are cloneable, but not internally mutable, so public methods need to be &mut self, otherwise you would need to take a mutex lock for every method (wasteful) or internally clone for each method (also wasteful).

@markmandel
Copy link
Collaborator Author

@Jake-Shadle do we have any concerns around tying our API to the Tokio async ecosystem?

If someone wanted to use async-std for example, would that be an issue for them?

@Jake-Shadle
Copy link
Contributor

Not particularly, it does mean an application would have 2 futures reactors/executors, but once you have created the future for either an async-std or tokio you can execute it on whichever reactor you want to use. So I believe the worst thing would be if some project doesn't already have a dependency on tokio at all, but wants to use agones, but honestly that seems like it would be an extremely rare case IME.

@markmandel
Copy link
Collaborator Author

So I believe the worst thing would be if some project doesn't already have a dependency on tokio at all, but wants to use agones, but honestly that seems like it would be an extremely rare case IME.

Yeah that doesn't bother me either. Sound good.

The biggest issue then is just making sure that our compliance tests still pass, and we maintain backward compatibility I think.

@markmandel
Copy link
Collaborator Author

Oh, and we need to update our rust examples too 😄

@Jake-Shadle
Copy link
Contributor

I think #2112 addresses all of the Rust code already? Or at least, CI passes now after converting the examples and matching the previous behavior (from the perspective of the tests).

@roberthbailey roberthbailey added this to the 1.16.0 milestone Jul 13, 2021
@roberthbailey roberthbailey added kind/breaking Breaking change kind/feature New features for Agones labels Jul 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/build-tools Development tooling. I.e. pretty much everything in the `build` directory. area/user-experience Pertaining to developers trying to use Agones, e.g. SDK, installation, etc good first issue These are great first issues. If you are looking for a place to start, start here! help wanted We would love help on these issues. Please come help us! kind/breaking Breaking change kind/feature New features for Agones
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants