Lari Hotari
08/11/2025, 5:22 PMS3FIFO Cache Eviction Algorithm Influence
This FIFO queue-based solution is influenced by the S3FIFO cache eviction algorithm (algorithm explanation), although it is not an implementation of S3FIFO. It accomplishes a similar goal as S3FIFO, but for the managed ledger broker cache. The goal of S3FIFO is to quickly remove entries that are unlikely to be accessed in the future. Similarly, the PIP-430 broker cache removal queue aims to quickly and efficiently remove entries that would be unlikely to be accessed in the future. The reason why S3FIFO is not implemented in broker cache is that in broker caching, the "expected read count" concept is used to determine whether an entry is likely to be accessed in the future. This information is not available in generic cache implementations, and in the broker cache this information can be used to keep entries in the cache longer that are likely to be accessed in the future.
The S3FIFO algorithm explanation blog post states: "While the eviction algorithms so far have been centered around LRU, I believe modern eviction algorithms should be designed with FIFO queues." This is one of the reasons why the PIP-430 broker cache removal queue is also based on a FIFO queue.The removal queue implementation is already part of master branch since PR https://github.com/apache/pulsar/pull/24363 contained the first part of PIP-430 implementation.
Lari Hotari
08/12/2025, 4:05 PM