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

Using other executors #497

Open
BusyJay opened this issue Nov 18, 2020 · 1 comment
Open

Using other executors #497

BusyJay opened this issue Nov 18, 2020 · 1 comment
Labels
Proposal Asking for new features

Comments

@BusyJay
Copy link
Member

BusyJay commented Nov 18, 2020

Is your feature request related to a problem? Please describe.
There are several executors in Rust world, like tokio, async-std, smol. TiKV project has developed its owned thread pool yatp. And grpcio has its own executor too, it's implemented on top of the poll engine build-in grpc c core. Due to grpc c core bind each call to the same thread (grpc/grpc#15535, for better locality), it's not recommended to do time consuming job in the executor. So people usually use one of the other executors mentioned above to get around the issue. For example, TiKV uses yatp to handle heavy computation or file IO.

But using different executors are not a good idea in some situations. For example, in resource limited environment, too many threads can have huge performance regression due to context switches. Using different executors means more threads usually. For style consideration, it's also cleaner to just keep using one executor.

grpc c core supports custom poll engine by using grpc_register_event_engine_factory. A custom poll engine can adapt other executors to fit in event_engine_factory_fn. For example, a tokio Reactor exposes similar APIs with event_engine_factory_fn. One downside is that grpc_register_event_engine_factory is a private interface, so it can't work when using dynamic link.

@BusyJay BusyJay changed the title Integration with other executors Using other executors Nov 18, 2020
@BusyJay BusyJay added the Proposal Asking for new features label Nov 18, 2020
@BusyJay
Copy link
Member Author

BusyJay commented Nov 17, 2021

Related design: https://github.com/grpc/proposal/pull/245/files

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

No branches or pull requests

1 participant