Rishabh Daim created OAK-12351:
----------------------------------
Summary: Restore a dedicated executor for Caffeine cache refreshes
Key: OAK-12351
URL: https://issues.apache.org/jira/browse/OAK-12351
Project: Jackrabbit Oak
Issue Type: Task
Reporter: Rishabh Daim
h3. Summary
Restore a dedicated executor for Caffeine cache refresh operations. Caffeine
refreshes currently share Oak's process-wide cache maintenance executor, so
slow refresh loads can compete with maintenance and refresh work from unrelated
caches.
h3. Background
Before [OAK-12152|https://issues.apache.org/jira/browse/OAK-12152] migrated
{{ElasticIndexStatistics}} from Guava to the Oak Caffeine-backed cache API,
Elastic used a dedicated four-thread executor for asynchronous refreshes. The
migration removed that executor and relied on Caffeine's executor instead.
[OAK-12290|https://issues.apache.org/jira/browse/OAK-12290] introduced Oak's
shared {{CacheMaintenanceExecutor}} for Caffeine maintenance and refresh work.
This preserves the asynchronous refresh boundary, but removes isolation between
blocking refresh loads and short maintenance tasks. Under saturation, the
current caller-runs fallback can execute refresh-related work on request
threads.
h3. Scope
Add a separate, bounded executor path for Caffeine refresh loads while
retaining the shared executor for short cache maintenance operations. Preserve
stale-while-revalidate behavior and avoid blocking callers that trigger a
refresh.
The related OSGi packaging test work is tracked separately in
[OAK-12350|https://issues.apache.org/jira/browse/OAK-12350].
h3. Acceptance criteria
* Caffeine refresh loads execute on a dedicated executor separate from the
cache maintenance executor.
* A refresh-triggering cache caller receives the stale value without executing
or waiting for the blocking refresh load.
* Cache eviction, removal notifications, and other short maintenance work
continue to use the maintenance executor.
* The executor is bounded and has clear shutdown/lifecycle behavior, or is
explicitly documented as process-wide and daemon-backed.
* JUnit 4 coverage verifies refresh execution on the dedicated executor and
verifies behavior when that executor is saturated.
--
This message was sent by Atlassian Jira
(v8.20.10#820010)