Improve FDB page cache policy
- Dominant language
- C++
- Stars
- 16.7k
- Forks
- 1.6k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 126
Description
#1506 adds a knob to switch from a random page replacement policy to LRU, which has sparked some further discussion.
ARC, CAR, and LIRS are the most widely implemented modern page replacement policies, but it's looking like [W-TinyLFU](https://arxiv.org/pdf/1512.00727.pdf) might be the most state-of-the-art. The probabilistic count-min sketch allows tracking approximate usage statistics for a much larger number of not-in-cache entries than the alternatives that track out-of-cache entries precisely. The [evaluation results](https://github.com/ben-manes/caffeine/wiki/Efficiency) look correspondingly rather promising, and Cassandra has [started using it](https://issues.apache.org/jira/browse/CASSANDRA-10855) as well.
We still do nothing to distinguish large scans from small reads, and the 5s transaction limit means large scans will be split across many calls, making them harder to identify. Storage servers do maintain a byte sample that could potentially be used to approximate how many bytes will be returned by a read, which could be fed into the decision of how the pages touched by this read should be counted as hits in the page cache.
It is worth noting that W-TinyLFU has a higher cost per lookup than {ARC,CAR,LIRS}, so maximum read throughput on smaller-than-the-cache workloads could suffer. ARC has patent-related concerns, CAR might, LIRS does not.
Contributor guide
Research direction
Start by reading #1506 and the linked W-TinyLFU evaluation, then review the issue’s discussion about ARC, CAR, LIRS, scan detection, and storage-server byte samples. Done would require an agreed policy and implementation plan, followed by validation that cache behavior and read throughput meet the project’s expectations.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- databases, distributed-systems, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100