Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR adds the S3FIFO eviction algorithm, as described here.
Running cachebench results show that S3FIFO achieves the highest hit rate among all evaluated algorithms. Throughput wise, it performs similarly with TinyLFU.
Our implementation adapts the existing TinyLFUMM.
Algorithm Detail
The algorithm maintains three structures:
The general idea of the algorithm is:
Each object carries one access bit that records whether it has been accessed since it was inserted or last inspected.
Items in the tail are:
Insertions are done as such:
We try to do eviction from S if the size > expected size (10%). Else, we try to evict from main.
Eviction iterator starts from tail and skips accessed items. Promotions (reinsertions) are done 1x before iterator is created.
Benchmark:
We evaluated S3FIFO using the test configurations in test_configs/hit_ratio with 48 threads and an 8 GB cache. We compared this against other existing MMContainers(LRU2Q, LRU, and TinyLFU). We use the DebugRel release version for testing.
The results can be found here
S3 FIFO Benchmark (2).pdf
Miss ratio:
S3FIFO consistently outperforms LRU, LRU2Q, and TinyLFU across all workloads.
Throughput:
Throughput is comparable to TinyLFU.
Notes: