Expand description
Concread - Concurrently Readable Datastructures
Concurrently readable is often referred to as Copy-On-Write, Multi-Version-Concurrency-Control or Software Transactional Memory.
These structures allow multiple readers with transactions to proceed while single writers can operate. A reader is guaranteed the content of their transaction will remain the same for the duration of the read, and readers do not block writers from proceeding. Writers are serialised, just like a mutex.
You can use these in place of a RwLock, and will likely see improvements in parallel throughput of your application.
The best use is in place of mutex/rwlock, where the reader exists for a non-trivial amount of time.
For example, if you have a RwLock where the lock is taken, data changed or read, and dropped immediately, this probably won’t help you.
However, if you have a RwLock where you hold the read lock for any amount of time, writers will begin to stall - or inversely, the writer will cause readers to block and wait as the writer proceeds.
§Features
This library provides multiple structures for you to use. You may enable or disable these based on our features.
ebr
- epoch based reclaim cellmaps
- concurrently readable b+tree and hashmapsarcache
- concurrently readable ARC cacheahash
- use the cpu accelerated ahash crate
By default all of these features are enabled. If you are planning to use this crate in a wasm
context we recommend you use only maps
as a feature.
Re-exports§
Modules§
- ARCache - A concurrently readable adaptive replacement cache.
- See the documentation for BptreeMap
- CowCell - A concurrently readable cell with Arc
- EbrCell - A concurrently readable cell with Ebr
- HashMap - A concurrently readable HashMap
- HashTrie - A concurrently readable HashTrie
- This module contains all the internals of how the complex concurrent datastructures are implemented. You should turn back now. Nothing of value is here. This module can only inflict horror upon you.