Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Instead of rigid LRU eviction, perform sampled LRU eviction. Sampled LRU eviction takes K random keys and picks the one with the lowest update timestamp. This way, even though the evicted element is not always the oldest in the whole cache, removes the necessity of maintaining a queue and reduces the contention caused by locking the queue. The K parameter is configurable, but the best performing value so far was 16 and it's used as the default one. The new eviction mechanism results in performance improvement in the cache eviction benchmarks: ``` read_only_accounts_cache_eviction_lo_hi/store/8 time: [17.986 µs 18.277 µs 18.566 µs] change: [-42.722% -35.752% -28.175%] (p = 0.00 < 0.05) Performance has improved. Found 5 outliers among 100 measurements (5.00%) 1 (1.00%) low mild 2 (2.00%) high mild 2 (2.00%) high severe read_only_accounts_cache_eviction_lo_hi/store/16 time: [19.124 µs 19.269 µs 19.400 µs] change: [-50.486% -45.520% -41.321%] (p = 0.00 < 0.05) Performance has improved. Found 5 outliers among 100 measurements (5.00%) 2 (2.00%) high mild 3 (3.00%) high severe read_only_accounts_cache_eviction_lo_hi/store/32 time: [20.350 µs 21.194 µs 22.227 µs] change: [-63.890% -60.900% -57.730%] (p = 0.00 < 0.05) Performance has improved. Found 12 outliers among 100 measurements (12.00%) 1 (1.00%) high mild 11 (11.00%) high severe read_only_accounts_cache_eviction_lo_hi/store/64 time: [28.981 µs 30.921 µs 32.968 µs] change: [-68.963% -65.463% -61.849%] (p = 0.00 < 0.05) Performance has improved. Found 6 outliers among 100 measurements (6.00%) 1 (1.00%) low mild 3 (3.00%) high mild 2 (2.00%) high severe ```
- Loading branch information