Versions (relevant - OpenSearch/Dashboard/Server OS/Browser):
- OpenSearch: 3.6.0
- Server OS: macOS (local dev env)
Describe the issue:
LRUCache.get(...)already holds the cache lock, but on hit it callsincRef(key), which re-enters lock logic and repeats key lookup.- This adds avoidable overhead on a very hot path in file-cache-heavy workloads.
- Proposed change:
- Add private
incRefNode(node)for already-resolved entries. - Use it in
get,addNode, andreplaceNode. - Keep public
incRef(key)behavior unchanged (delegates internally to the node helper after lookup).
- Add private
- Safety:
- No API or wire/protocol changes.
- No behavior changes to refcount/LRU/stat semantics, only removal of redundant work.
- Local microbenchmark result:
FileCacheBenchmark.get:8101.39 -> 13393.85 ops/ms(+65.33%).
Configuration:
- Benchmark:
FileCacheBenchmark.get - Params:
maximumNumberOfEntries=65536,concurrencyLevel=8 - JMH profile:
-wi 3 -i 5 -w 2s -r 2s -f 2 -t 8
Relevant Logs or Screenshots:
- Patch screenshot attached
Feedback requested:
- Do you see any concurrency or eviction edge cases this change could miss?
- Any concerns that stats accounting could diverge from existing behavior?
- Are there additional workloads/benchmarks you want to see before proposing upstream?
