-
-
Notifications
You must be signed in to change notification settings - Fork 73
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
Possibility of using async runtime tasks instead of thread pools #288
Comments
Hi, thank you for the suggestions.
Yes, I believe it is possible. However it will make Instead of doing that, I was thinking to remove these background threads completely, so that To do that for I found removing the background threads would cause a major breaking changes on the API:
Let me review and remember what I did there, and then I will do it again for v0.12.0 release. Since it will be a major breaking change, we will need to write a migration guide. |
I started to work on this for v0.12.0 release: See the MIGRATION-GUIDE.md for details of the change. Since this will be a major breaking change on |
Somewhat related, a neat trick with async support is that should be able to combine it with other libraries very easily to perform more advanced operations. I wrote a few simple examples in Java that I think would work very well in moka.
I'm not familiar enough with Rust's async runtimes, but I bet you could write similar examples once this is complete to demonstrate the flexibility of your library. |
I have merged the huge pull request #294 into the You will be affected by the above if you use If you are not affected, you can try the thread-pool-less [dependencies.moka]
git = "https://github.com/moka-rs/moka"
branch = "main"
default-features = false # Necessary for now to turn off `sync::Cache`.
features = ["future", "atomic64", "quanta"] # atomic64 and quanta are in the default features. Also, now the MIGRATION-GUIDE.md is available on the |
@stepantubanov @DDtKey @tobz1000 I published moka Its [dependencies]
# `default-features = false` is necessary for now to turn off `sync::Cache`.
# atomic64 and quanta are in the default features.
moka = { version = "0.12.0-beta.1", default-features = false, features = ["future", "atomic64", "quanta"] } You may/may not need to change your codes to use |
I published moka Its [dependencies]
moka = { version = "0.12.0-beta.2", features = ["future"] } I also updated the MIGRATION-GUIDE.md. |
Ah, I forgot to enable |
I published moka [dependencies]
moka = { version = "0.12.0-beta.3", features = ["future"] } I am hoping this is going to be the last beta. If everything goes well, I will release v0.12.0 in a week or so. This beta.3 has no API change. It has minor improvements on internal implementations: |
Closing this as completed. I published moka |
While investigating high thread count and occasional CPU throttling I noticed that moka is creating it's own thread pool. Together with Tokio runtime it results in number of threads being 2x greater than "available parallelism". I was wondering if it would be possible to convert those threads into async runtime tasks? What would be main challenges there and is it a lot of work? Main reasoning for this is to have better control over CPU resources and reduce throttling.
Related issues:
The text was updated successfully, but these errors were encountered: