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

Will there be support for load balancing? #268

Open
ronniec95 opened this issue Oct 2, 2019 · 9 comments
Open

Will there be support for load balancing? #268

ronniec95 opened this issue Oct 2, 2019 · 9 comments

Comments

@ronniec95
Copy link

Title says it all. It would be great to have multiple instances of a service and a client can send requests to them all. I imagine it would need to be coupled with exponential backoff and some kind of dynamic discovery.

Are you open to funding to implement this?

@LucioFranco
Copy link

I'd love to see support for this! @tikue tonic provides a basic load balancing feature but there is much much more that can be done https://docs.rs/tonic/0.1.0-alpha.1/tonic/transport/struct.Channel.html#method.balance_list.

Happy to collab!

@tikue
Copy link
Collaborator

tikue commented Oct 2, 2019

I most certainly am open to contributions of this sort! Load balancing would be a hugely beneficial feature to offer users. Would it be possible to have a load balancing client implement the Client trait? If so, it should even be possible to develop such a feature out of tree. That'd be a great way to test proof of concept.

@LucioFranco
Copy link

@tikue I think we could probably adapt the tonic::transport module to implement your traits possibly. The best way though would be to swap client for service. I think it would be cool also to provide a http2 transport for tarpc.

@tikue
Copy link
Collaborator

tikue commented Oct 2, 2019

@LucioFranco I think the path of least resistance may be a 3rd crate that provides a shim over tonic to impl tarpc's traits. I definitely am interested to explore unifying traits, I just wouldn't want that conversation to discourage someone from taking on this work if they're interested sooner!

@ronniec95
Copy link
Author

I was thinking utilising https://github.com/tower-rs/tower/ would be interesting. They have discovery service and 2 load-balancing strategies as well as other interesting features. I'm not sure how simple it would be

@LucioFranco
Copy link

@tikue Yeah, I don't think using tonic directly right now is the best idea. Mostly, the transport is a good reference implementation for using tower and hyper as a transport for an rpc.

@ronniec95 yup, this is what we use in tonic internally. I am very happy to help see how these could be used. We have a v0.3.x branch with support for std::future::Future.

@tikue
Copy link
Collaborator

tikue commented Oct 3, 2019

Yeah reusing existing libraries is definitely my preference. I personally am not an expert at load balancing and very much doubt I could do a better job than whatever tower has already done :) I think the novel work here will be more or less integrating those libraries with tarpc's APIs. If we get something hooked up, we can then spend time making it nicer to use directly from tarpc.

@ronniec95
Copy link
Author

@tikue You've got the best person here who understands tower and yourself for tarpc. I'm not sure I can contribute much unless you can direct me.

@tikue
Copy link
Collaborator

tikue commented Oct 3, 2019

I would love to personally work on this but probably won't have much time to devote to it in the coming weeks. I'm more than happy to provide guidance if you or anyone else would like to contribute, but no pressure at all -- getting started on contributing to tarpc is not as easy as it could be.

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

No branches or pull requests

3 participants