Comments (1)
Thanks for raising the request. Exposing these configurations should be easy, so I will just do it.
These thread pools are shared across all cache instances, so these limits will be cache-global configurations. Also, the thread pool library we use now does not support growing and shrinking the number of worker threads. So for now, they will be fixed numbers of worker threads, instead of limits (the maximum numbers of worker threads).
One limitation is that you cannot change those numbers while cache instances exist. So you will set them before creating any cache.
Just to clarify, this is how they work now (as of Moka v0.8.5):
(I will put them to somewhere in the doc)
- There are two global thread pools:
- Housekeeping
- Used by all concurrent caches (
sync
,future
, experimentaldash
caches). - Used for:
- Updating internal cache data structures such as LRU queue and LFU filter.
- Removing expired entries.
- etc.
- Used by all concurrent caches (
- Invalidation
- Used by
sync
andfuture
caches with invalidation_closures configuration explicitly enabled. - Used for executing user-provided invalidation closures on cache entries.
- Used by
- Housekeeping
- A pool will be shared across all cache instance:
- There should be zero or one housekeeping pool, and zero or one invalidation pool, no matter how many cache instances have been created.
- A pool will be created when a cache using it is created.
- I think many users do not set invalidation closures, so only the housekeeping thread pool will be created in many cases.
- A pool will be dropped when all cache using it have been dropped.
- A pool has a fixed number of worker threads:
- The number is the same to available logical cores of the processor(s) of the machine.
- I will make the number configurable.
from moka.
Related Issues (20)
- Conditional/Delayed Eviction HOT 1
- Update documentation HOT 1
- Flaky test `cht::segment::tests::drop_many_values` under Cargo Tarpaulin HOT 1
- high resource usage in the housekeeper HOT 9
- Bug in `moka::future::Cache::invalidate_all`? Elements not being invalidated immediatelly. HOT 3
- feat: Notifications on eviction, etc. HOT 1
- Vulnerable to CVE-2022-23639? HOT 7
- Implications of `Arc<K>: Borrow<Q>` HOT 2
- dash Cache has no `get_with` HOT 2
- CI: Run Linux AArch64 tests on real hardware HOT 3
- Memory leak after `moka::sync::Cache` is dropped HOT 4
- Moka counter & multiple cache integration HOT 3
- cache line optimized CountMin4
- Add new api similar to `try_get_with`, but return `Option` rather than `Result`? HOT 6
- Is it worth to modify the key of `get_with` as a `&K` rather than `K`? HOT 10
- Help with size based eviction that weighs with bytes HOT 2
- moka is too polymorphic (cargo-llvm-lines) HOT 3
- Setting number of segments will disable notifications HOT 2
- try_get_with always runs init future HOT 4
- Staggering expiry with TTL HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from moka.