Implement block level cache #17
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
All B-Tree operations first go through the cache, modified pages are queued for background writing, and there is proper cleanup and flushing and destruction.
The block level cache and multi threaded writer queue use the PageCache class and the WriterQueue class. The PageCache class is used for LRU based caching, dirty page tracing, eviction when the cache is full, and operations with mutex protection. The WriterQueue class is used for multi threaded background write processing, queue based batching, and async write processing.
This design keeps content-addressable deduplication while achieving 2.3× throughput improvements by caching hot pages and processing writes asynchronously in background threads, so that there are no more I/O bottlenecks that previously serialized database operations.