grpc-rust icon indicating copy to clipboard operation
grpc-rust copied to clipboard

Integrate with tokio runtime?

Open netvl opened this issue 6 years ago • 4 comments

I'm currently writing an application which exposes a gRPC service. This application, however, performs other async tasks, not only running the server. I would like to use tokio runtime to run everything in a single event loop, but apparently grpc-rust is not integrated with tokio runtime; it uses cpupool or tokio-core instead. Even though it allows specifying an external event loop for the server, it requires Remote from tokio-core, which is not compatible with tokio::reactor::Handle.

Is integration with tokio runtime planned? As far as I understand, it is the intended way to write async applications now.

netvl avatar May 05 '18 21:05 netvl

@stepancheg Can I assume you're not working on this right now? I don't mind jumping in to help here. I suppose we need to update https://github.com/stepancheg/rust-http2 first.

mehcode avatar Nov 02 '18 23:11 mehcode

FYI currently I'm doing a big rewrite of rust-http2 API, to make API more similar to h2/grpc-rs.

The task is here: https://github.com/stepancheg/rust-http2/issues/34

(It is mostly done, but cleanup is necessary).

New server API is for instance:

After that, I'm planning to change grpc-rust to have similar API: https://github.com/stepancheg/grpc-rust/issues/137 (making it again more similar to h2/grps-rs; should be easy because the grpc runtime is a thin wrapper around http2 runtime)

While API changes, I'd appreciate feedback about API/design/code review/etc.

Patches are also appreciated of course.

stepancheg avatar Nov 02 '18 23:11 stepancheg

tokio-core to tokio isn't a large change. It can just feel large. I've changed over a number of libs already. I'll see what I can do with a PR to rust-http2 to remove tokio-core.

mehcode avatar Nov 05 '18 21:11 mehcode

We should definitely do this.

thedodd avatar Jan 29 '19 18:01 thedodd