[
https://issues.apache.org/jira/browse/OAK-12425?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Rishabh Daim updated OAK-12425:
-------------------------------
Description:
h3. Summary
Allow oak-store-document to opt into Caffeine with synchronous maintenance
while preserving the existing CacheLIRS persistent-cache implementation and
metadata flow.
h3. Scope
Build on OAK-12436 and OAK-12438. Gate Caffeine selection behind
FT_CAFFEINE_CACHE_OAK-12425, disabled by default. Standalone processes
explicitly opt in using -Doak.documentMK.caffeineCache=true. Select SYNC
maintenance for all Document caches. Retain CacheLIRS for positive-weight
LOCAL_DIFF even when Caffeine is enabled; the zero-weight path keeps its
existing no-cache behavior. Snapshot implementation selection once per builder
and require a replacement builder/DocumentNodeStore after a feature change.
Register the eviction listener before the persistent wrapper attaches its
callback.
Keep NodeCache, CacheMetadata, raw values, live maps, custom weights, cache
statistics, the persistent file format and persistent-write behavior unchanged.
Entry-owned metadata, new mutation monitors and guarded persistence belong
exclusively to OAK-12437's optional ASYNC path. Add further production fixes
here only when a test demonstrates a Caffeine SYNC compatibility issue.
h3. Acceptance Criteria
* Default feature-off behavior retains CacheLIRS and the original
persistent-cache wrapper.
* Feature-on behavior uses Caffeine SYNC except LOCAL_DIFF, which retains
CacheLIRS admission with the original metadata representation and no new entry
overhead.
* Implementation selection remains stable across caches constructed by the same
builder; feature changes require restart/recreation.
* Persistent size evictions reach the existing wrapper, including when the
listener is attached after memory-cache construction.
* Existing persistence, broadcast, compatibility, loader and raw-value/weight
tests pass with both CacheLIRS and Caffeine SYNC under Java 17.
* [PR #3176|https://github.com/apache/jackrabbit-oak/pull/3176] contains the
minimal SYNC migration. Optional ASYNC and entry-owned metadata are in
[OAK-12437|https://issues.apache.org/jira/browse/OAK-12437] / PR #3190;
comparative measurements follow in OAK-12426 / PR #3174.
h3. LOCAL_DIFF compatibility
Repository commit/diff benchmarks reproduce a large write regression with
Caffeine SYNC admission: large setup diffs can displace freshly published small
diffs before their first lookup, forcing expensive sibling-state
reconstruction. Keep LOCAL_DIFF on the existing LIRS builder, preserving its
memory budget, segment settings, raw weights, persistence wrapper and eviction
callbacks. Test fresh-diff retention under real eviction pressure, zero-weight
behavior and stable implementation selection. [Diagnosis and repeated benchmark
results|https://github.com/apache/jackrabbit-oak/pull/3174#issuecomment-5886471110].
h3. Benchmark audit and migration goal
The goal remains Caffeine throughout oak-store-document. The LOCAL_DIFF LIRS
exception is a temporary regression mitigation/control; do not treat the hybrid
policy as a completed all-Caffeine migration. OAK-12426 measures normal commits
plus saved-value verification separately from commits with an additional
explicit parent diff. Use 256 MiB as the primary total repository-cache budget
with production distribution, and 384 MiB for 50% more memory. Compare the
hybrid policy against all-Caffeine LOCAL_DIFF controls. Report merge, explicit
diff and readback time, local-diff memory hits/misses and backend finds.
Exercise a larger working set under the same 256/384 MiB budgets. Label earlier
16/24 MiB results as memory-pressure diagnostics, not typical production
throughput. EmptyHook and MemoryDocumentStore omit application hooks and remote
database latency.
was:
h3. Summary
Allow oak-store-document to opt into Caffeine with synchronous maintenance
while preserving the existing CacheLIRS persistent-cache implementation and
metadata flow.
h3. Scope
Build on OAK-12436 and OAK-12438. Gate Caffeine selection behind
FT_CAFFEINE_CACHE_OAK-12425, disabled by default. Standalone processes
explicitly opt in using -Doak.documentMK.caffeineCache=true. Select SYNC
maintenance for all Document caches. Retain CacheLIRS for positive-weight
LOCAL_DIFF even when Caffeine is enabled; the zero-weight path keeps its
existing no-cache behavior. Snapshot implementation selection once per builder
and require a replacement builder/DocumentNodeStore after a feature change.
Register the eviction listener before the persistent wrapper attaches its
callback.
Keep NodeCache, CacheMetadata, raw values, live maps, custom weights, cache
statistics, the persistent file format and persistent-write behavior unchanged.
Entry-owned metadata, new mutation monitors and guarded persistence belong
exclusively to OAK-12437's optional ASYNC path. Add further production fixes
here only when a test demonstrates a Caffeine SYNC compatibility issue.
h3. Acceptance Criteria
* Default feature-off behavior retains CacheLIRS and the original
persistent-cache wrapper.
* Feature-on behavior uses Caffeine SYNC except LOCAL_DIFF, which retains
CacheLIRS admission with the original metadata representation and no new entry
overhead.
* Implementation selection remains stable across caches constructed by the same
builder; feature changes require restart/recreation.
* Persistent size evictions reach the existing wrapper, including when the
listener is attached after memory-cache construction.
* Existing persistence, broadcast, compatibility, loader and raw-value/weight
tests pass with both CacheLIRS and Caffeine SYNC under Java 17.
* [PR #3176|https://github.com/apache/jackrabbit-oak/pull/3176] contains the
minimal SYNC migration. Optional ASYNC and entry-owned metadata are in
[OAK-12437|https://issues.apache.org/jira/browse/OAK-12437] / PR #3190;
comparative measurements follow in OAK-12426 / PR #3174.
h3. LOCAL_DIFF compatibility
Repository commit/diff benchmarks reproduce a large write regression with
Caffeine SYNC admission: large setup diffs can displace freshly published small
diffs before their first lookup, forcing expensive sibling-state
reconstruction. Keep LOCAL_DIFF on the existing LIRS builder, preserving its
memory budget, segment settings, raw weights, persistence wrapper and eviction
callbacks. Test fresh-diff retention under real eviction pressure, zero-weight
behavior and stable implementation selection. [Diagnosis and repeated benchmark
results|https://github.com/apache/jackrabbit-oak/pull/3174#issuecomment-5886471110].
> Opt into Caffeine SYNC maintenance in oak-store-document
> --------------------------------------------------------
>
> Key: OAK-12425
> URL: https://issues.apache.org/jira/browse/OAK-12425
> Project: Jackrabbit Oak
> Issue Type: Technical task
> Reporter: Rishabh Daim
> Assignee: Rishabh Daim
> Priority: Major
>
> h3. Summary
> Allow oak-store-document to opt into Caffeine with synchronous maintenance
> while preserving the existing CacheLIRS persistent-cache implementation and
> metadata flow.
> h3. Scope
> Build on OAK-12436 and OAK-12438. Gate Caffeine selection behind
> FT_CAFFEINE_CACHE_OAK-12425, disabled by default. Standalone processes
> explicitly opt in using -Doak.documentMK.caffeineCache=true. Select SYNC
> maintenance for all Document caches. Retain CacheLIRS for positive-weight
> LOCAL_DIFF even when Caffeine is enabled; the zero-weight path keeps its
> existing no-cache behavior. Snapshot implementation selection once per
> builder and require a replacement builder/DocumentNodeStore after a feature
> change. Register the eviction listener before the persistent wrapper attaches
> its callback.
> Keep NodeCache, CacheMetadata, raw values, live maps, custom weights, cache
> statistics, the persistent file format and persistent-write behavior
> unchanged. Entry-owned metadata, new mutation monitors and guarded
> persistence belong exclusively to OAK-12437's optional ASYNC path. Add
> further production fixes here only when a test demonstrates a Caffeine SYNC
> compatibility issue.
> h3. Acceptance Criteria
> * Default feature-off behavior retains CacheLIRS and the original
> persistent-cache wrapper.
> * Feature-on behavior uses Caffeine SYNC except LOCAL_DIFF, which retains
> CacheLIRS admission with the original metadata representation and no new
> entry overhead.
> * Implementation selection remains stable across caches constructed by the
> same builder; feature changes require restart/recreation.
> * Persistent size evictions reach the existing wrapper, including when the
> listener is attached after memory-cache construction.
> * Existing persistence, broadcast, compatibility, loader and raw-value/weight
> tests pass with both CacheLIRS and Caffeine SYNC under Java 17.
> * [PR #3176|https://github.com/apache/jackrabbit-oak/pull/3176] contains the
> minimal SYNC migration. Optional ASYNC and entry-owned metadata are in
> [OAK-12437|https://issues.apache.org/jira/browse/OAK-12437] / PR #3190;
> comparative measurements follow in OAK-12426 / PR #3174.
> h3. LOCAL_DIFF compatibility
> Repository commit/diff benchmarks reproduce a large write regression with
> Caffeine SYNC admission: large setup diffs can displace freshly published
> small diffs before their first lookup, forcing expensive sibling-state
> reconstruction. Keep LOCAL_DIFF on the existing LIRS builder, preserving its
> memory budget, segment settings, raw weights, persistence wrapper and
> eviction callbacks. Test fresh-diff retention under real eviction pressure,
> zero-weight behavior and stable implementation selection. [Diagnosis and
> repeated benchmark
> results|https://github.com/apache/jackrabbit-oak/pull/3174#issuecomment-5886471110].
> h3. Benchmark audit and migration goal
> The goal remains Caffeine throughout oak-store-document. The LOCAL_DIFF LIRS
> exception is a temporary regression mitigation/control; do not treat the
> hybrid policy as a completed all-Caffeine migration. OAK-12426 measures
> normal commits plus saved-value verification separately from commits with an
> additional explicit parent diff. Use 256 MiB as the primary total
> repository-cache budget with production distribution, and 384 MiB for 50%
> more memory. Compare the hybrid policy against all-Caffeine LOCAL_DIFF
> controls. Report merge, explicit diff and readback time, local-diff memory
> hits/misses and backend finds. Exercise a larger working set under the same
> 256/384 MiB budgets. Label earlier 16/24 MiB results as memory-pressure
> diagnostics, not typical production throughput. EmptyHook and
> MemoryDocumentStore omit application hooks and remote database latency.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)