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

Rishabh Daim updated OAK-12437:
-------------------------------
    Description: 
h3. Summary
Add optional per-cache asynchronous Caffeine maintenance together with 
entry-owned persistent-cache metadata. Gate the complete ASYNC implementation 
behind disabled-by-default FT_OAK-12437.

h3. Scope
Build on OAK-12425's minimal FT-gated Caffeine SYNC migration. Caffeine must 
also be enabled. When FT_OAK-12437 is off, even explicit ASYNC requests use the 
exact OAK-12425 SYNC cache/wrapper/metadata path. When enabled, only explicitly 
selected eligible CacheTypes use ASYNC; unconfigured caches and LOCAL_DIFF 
remain SYNC. LOCAL_DIFF retains the parent LIRS/original-metadata path, even 
when ASYNC is explicitly requested. Standalone ASYNC requires both 
-Doak.documentMK.caffeineCache=true and 
-Doak.documentMK.asyncCacheMaintenance=true.

Only persistent caches actually selected as ASYNC use entry-owned access count, 
persistence-origin, retirement and invalidation-generation metadata, live 
raw-value adapters, per-key mutation coordination and guarded persistence 
writes. Preserve the original NodeCache and CacheMetadata for SYNC and 
CacheLIRS. FT-off operation must not add ASYNC entry overhead or use the new 
wrapper and guarded-write protocol. Keep the persisted value format unchanged.

A builder snapshots feature selection once. Existing caches retain their 
implementation and mode. Recreate the builder and DocumentNodeStore after 
changing either feature; preserve desired toggle state across service 
stop/start. Segment Tar remains independent.

h3. Acceptance Criteria
* Default FT-off behavior is the parent SYNC behavior, including wrapper 
identity, raw map behavior and exact custom weights.
* ASYNC requires the Caffeine FT, the ASYNC FT and explicit per-cache selection 
together.
* Caffeine-off ASYNC requests retain CacheLIRS and resolve to SYNC.
* Entry metadata follows the exact cache entry; delayed callbacks cannot 
consume replacement metadata or persist invalidated/stale entries.
* Async-only loading and guarded-write changes cannot affect the legacy/SYNC 
path.
* Tests cover all feature/mode combinations, toggle transitions/restart, actual 
callback threads, production persistent caches, raw map mutations and delayed 
persistence ordering. Existing legacy persistence tests continue passing 
unchanged.
* [PR #3190|https://github.com/apache/jackrabbit-oak/pull/3190] directly 
depends on [PR #3176|https://github.com/apache/jackrabbit-oak/pull/3176]. 
OAK-12426 / PR #3174 compares the legacy-metadata SYNC path against the 
entry-metadata ASYNC path and must rerun measurements after this rescope.

* LOCAL_DIFF always resolves to SYNC and uses original NodeCache 
metadata/weights with persistence enabled. Positive-weight LOCAL_DIFF retains 
LIRS; zero-weight LOCAL_DIFF keeps the existing no-cache path. Test both 
features, persistence on/off, zero/nonzero budgets and inline callbacks while 
other caches still honor ASYNC opt-in.


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
Add optional per-cache asynchronous Caffeine maintenance together with 
entry-owned persistent-cache metadata. Gate the complete ASYNC implementation 
behind disabled-by-default FT_OAK-12437.

h3. Scope
Build on OAK-12425's minimal FT-gated Caffeine SYNC migration. Caffeine must 
also be enabled. When FT_OAK-12437 is off, even explicit ASYNC requests use the 
exact OAK-12425 SYNC cache/wrapper/metadata path. When enabled, only explicitly 
selected eligible CacheTypes use ASYNC; unconfigured caches and LOCAL_DIFF 
remain SYNC. LOCAL_DIFF retains the parent LIRS/original-metadata path, even 
when ASYNC is explicitly requested. Standalone ASYNC requires both 
-Doak.documentMK.caffeineCache=true and 
-Doak.documentMK.asyncCacheMaintenance=true.

Only persistent caches actually selected as ASYNC use entry-owned access count, 
persistence-origin, retirement and invalidation-generation metadata, live 
raw-value adapters, per-key mutation coordination and guarded persistence 
writes. Preserve the original NodeCache and CacheMetadata for SYNC and 
CacheLIRS. FT-off operation must not add ASYNC entry overhead or use the new 
wrapper and guarded-write protocol. Keep the persisted value format unchanged.

A builder snapshots feature selection once. Existing caches retain their 
implementation and mode. Recreate the builder and DocumentNodeStore after 
changing either feature; preserve desired toggle state across service 
stop/start. Segment Tar remains independent.

h3. Acceptance Criteria
* Default FT-off behavior is the parent SYNC behavior, including wrapper 
identity, raw map behavior and exact custom weights.
* ASYNC requires the Caffeine FT, the ASYNC FT and explicit per-cache selection 
together.
* Caffeine-off ASYNC requests retain CacheLIRS and resolve to SYNC.
* Entry metadata follows the exact cache entry; delayed callbacks cannot 
consume replacement metadata or persist invalidated/stale entries.
* Async-only loading and guarded-write changes cannot affect the legacy/SYNC 
path.
* Tests cover all feature/mode combinations, toggle transitions/restart, actual 
callback threads, production persistent caches, raw map mutations and delayed 
persistence ordering. Existing legacy persistence tests continue passing 
unchanged.
* [PR #3190|https://github.com/apache/jackrabbit-oak/pull/3190] directly 
depends on [PR #3176|https://github.com/apache/jackrabbit-oak/pull/3176]. 
OAK-12426 / PR #3174 compares the legacy-metadata SYNC path against the 
entry-metadata ASYNC path and must rerun measurements after this rescope.

* LOCAL_DIFF always resolves to SYNC and uses original NodeCache 
metadata/weights with persistence enabled. Positive-weight LOCAL_DIFF retains 
LIRS; zero-weight LOCAL_DIFF keeps the existing no-cache path. Test both 
features, persistence on/off, zero/nonzero budgets and inline callbacks while 
other caches still honor ASYNC opt-in.



> Opt into Document Caffeine ASYNC maintenance with entry-owned metadata
> ----------------------------------------------------------------------
>
>                 Key: OAK-12437
>                 URL: https://issues.apache.org/jira/browse/OAK-12437
>             Project: Jackrabbit Oak
>          Issue Type: Task
>            Reporter: Rishabh Daim
>            Priority: Major
>
> h3. Summary
> Add optional per-cache asynchronous Caffeine maintenance together with 
> entry-owned persistent-cache metadata. Gate the complete ASYNC implementation 
> behind disabled-by-default FT_OAK-12437.
> h3. Scope
> Build on OAK-12425's minimal FT-gated Caffeine SYNC migration. Caffeine must 
> also be enabled. When FT_OAK-12437 is off, even explicit ASYNC requests use 
> the exact OAK-12425 SYNC cache/wrapper/metadata path. When enabled, only 
> explicitly selected eligible CacheTypes use ASYNC; unconfigured caches and 
> LOCAL_DIFF remain SYNC. LOCAL_DIFF retains the parent LIRS/original-metadata 
> path, even when ASYNC is explicitly requested. Standalone ASYNC requires both 
> -Doak.documentMK.caffeineCache=true and 
> -Doak.documentMK.asyncCacheMaintenance=true.
> Only persistent caches actually selected as ASYNC use entry-owned access 
> count, persistence-origin, retirement and invalidation-generation metadata, 
> live raw-value adapters, per-key mutation coordination and guarded 
> persistence writes. Preserve the original NodeCache and CacheMetadata for 
> SYNC and CacheLIRS. FT-off operation must not add ASYNC entry overhead or use 
> the new wrapper and guarded-write protocol. Keep the persisted value format 
> unchanged.
> A builder snapshots feature selection once. Existing caches retain their 
> implementation and mode. Recreate the builder and DocumentNodeStore after 
> changing either feature; preserve desired toggle state across service 
> stop/start. Segment Tar remains independent.
> h3. Acceptance Criteria
> * Default FT-off behavior is the parent SYNC behavior, including wrapper 
> identity, raw map behavior and exact custom weights.
> * ASYNC requires the Caffeine FT, the ASYNC FT and explicit per-cache 
> selection together.
> * Caffeine-off ASYNC requests retain CacheLIRS and resolve to SYNC.
> * Entry metadata follows the exact cache entry; delayed callbacks cannot 
> consume replacement metadata or persist invalidated/stale entries.
> * Async-only loading and guarded-write changes cannot affect the legacy/SYNC 
> path.
> * Tests cover all feature/mode combinations, toggle transitions/restart, 
> actual callback threads, production persistent caches, raw map mutations and 
> delayed persistence ordering. Existing legacy persistence tests continue 
> passing unchanged.
> * [PR #3190|https://github.com/apache/jackrabbit-oak/pull/3190] directly 
> depends on [PR #3176|https://github.com/apache/jackrabbit-oak/pull/3176]. 
> OAK-12426 / PR #3174 compares the legacy-metadata SYNC path against the 
> entry-metadata ASYNC path and must rerun measurements after this rescope.
> * LOCAL_DIFF always resolves to SYNC and uses original NodeCache 
> metadata/weights with persistence enabled. Positive-weight LOCAL_DIFF retains 
> LIRS; zero-weight LOCAL_DIFF keeps the existing no-cache path. Test both 
> features, persistence on/off, zero/nonzero budgets and inline callbacks while 
> other caches still honor ASYNC opt-in.
> 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)

Reply via email to