[ 
https://issues.apache.org/jira/browse/OAK-12214?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Rishabh Daim updated OAK-12214:
-------------------------------
    Description: 
*Segment cache (L2)*: Caffeine W-TinyLFU and Guava LRU only learn about 
accesses that go through _SegmentCache.getSegment()_. Production traffic often 
hits _SegmentId.getSegment()_ and returns the memoized segment from L1 without 
touching L2. That made eviction policies act on stale frequency/recency while 
the JVM was still reading “hot” segments from L1 — wrong evictions, extra TAR 
reads, and skewed benchmarks vs reality.

This was working for Guava, since it was using the LRU eviction policy.

*Fix*: On every L1 hit, call _SegmentCache.recordHit(SegmentId)_, which 
performs _cache.getIfPresent(id)_ on the backing L2 so policies see real usage, 
plus existing hit accounting.

  was:
*Segment cache (L2)*: Caffeine W-TinyLFU and Guava LRU only learn about 
accesses that go through SegmentCache.getSegment(). Production traffic often 
hits SegmentId.getSegment() and returns the memoized segment from L1 without 
touching L2. That made eviction policies act on stale frequency/recency while 
the JVM was still reading “hot” segments from L1 — wrong evictions, extra TAR 
reads, and skewed benchmarks vs reality.

*Fix*: On every L1 hit, call SegmentCache.recordAccess(SegmentId), which 
performs cache.getIfPresent(id) on the backing L2 so policies see real usage, 
plus existing hit accounting.


> SegmentCache: L1 hits should notify L2 (caffeine) to keep frequency/recency 
> accurate
> ------------------------------------------------------------------------------------
>
>                 Key: OAK-12214
>                 URL: https://issues.apache.org/jira/browse/OAK-12214
>             Project: Jackrabbit Oak
>          Issue Type: Task
>            Reporter: Rishabh Daim
>            Assignee: Rishabh Daim
>            Priority: Major
>
> *Segment cache (L2)*: Caffeine W-TinyLFU and Guava LRU only learn about 
> accesses that go through _SegmentCache.getSegment()_. Production traffic 
> often hits _SegmentId.getSegment()_ and returns the memoized segment from L1 
> without touching L2. That made eviction policies act on stale 
> frequency/recency while the JVM was still reading “hot” segments from L1 — 
> wrong evictions, extra TAR reads, and skewed benchmarks vs reality.
> This was working for Guava, since it was using the LRU eviction policy.
> *Fix*: On every L1 hit, call _SegmentCache.recordHit(SegmentId)_, which 
> performs _cache.getIfPresent(id)_ on the backing L2 so policies see real 
> usage, plus existing hit accounting.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to