-
Notifications
You must be signed in to change notification settings - Fork 481
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(services/monoiofs): monoio wrapper #4885
Conversation
That sounds great. I recall @ihciah mentioning that they've done some work internally to make monoio compatible with the tokio runtime. Do you think this feature should be integrated into the upstream monoio? |
Yes, there is already a compatibility layer crate
My code here only focuses on our use case inside monoiofs. There are a few issue comments in monoio requesting similar feature but most of them concern other scenarios. Maybe we can later generalize it and contribute that to monoio. |
Hi, @NKID00, thanks for your update. This PR is mostly ready to merge, can you help resolving the conflicts? |
Sure. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, let's move!
Part of #4552.
Since monoio runtime can't cooperate with tokio runtime on the same thread, this PR introduces a wrapper in
monoiofs
that wraps monoio runtime in a thread pool and provides a method that may be called in context of other runtimes to dispatch futures to the thread pool and execute it in context of monoio.This is similar to the implementation of
compfs
, however since monoio doesn't provide a crate likecompio-dispatcher
to do these, I've implemented a minimal usable dispatcher here. This dispatcher implementation sends futures to threads at random (same ascompio-dispatcher
) without scheduling or load balancing, but it should serve for implementing rest of the service on top of it and we can improve its performance later if necessary.