-
Notifications
You must be signed in to change notification settings - Fork 218
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
Introduce async framework and clean up prefetch related logic #467
Conversation
af281a1
to
443baae
Compare
Currently AsyncWorkerMgr is implemented by using synchronous multi-threading, which has some limitations. So let's build async framework for AsyncWorkerMgr by: 1) Implement unbound multi-producer multi-consumer (mpmc) channel by using tokio::sync::Notify 2) Use tokio current thread Runtime instead of the default multi-threaded Runtime. This will help to support io-uring in future. 3) Use work-stealing mode to dispatch tasks. Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Rename AsyncRequestState to AsyncPrefetchState. Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Move network bandwidth rate limiter from AsyncWorkerMgr::send() to AsyncWorkerMgr::run(). Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Add test case for network bandwidth rate limiter. Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
1) group current function as prefetch related 2) centralize rate limit for prefetch requests 3) prepare to support other non-prefetch request messages Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Syntax only refinements to fscache, there should be no functional changes. Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
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.
can you please elaborate why mpmc is needed here?
I see that mpsc might be used to serve two async workers, but why do we need two workers if it's async already?
Currently we have enabled the async runtime framework, but most internal implementation is still in sync mode. |
The data prefetch related code has been refactored several times, and it becomes a little complex. So go over code again to remove some legacy code. The most important change is to use reference count to track prefetch status instead of an on/off flag. It gets messy with the on/off flag when dealing with blob sharing/reuse. Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Add a picture for data prefetch architure. Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
Flush pending prefetch requests when closing fscache fd, otherwise the blob gc will be blocked. Signed-off-by: Jiang Liu <gerry@linux.alibaba.com>
The main change is to build an async framework for storage/worker by using tokio Notify and current thread runtime.
Also clean up data prefetch related logic, those are left over from legacy code.