Skip to content

Reduce lock contention in UsageTrackingQueryCachingPolicy#16306

Open
prudhvigodithi wants to merge 2 commits into
apache:mainfrom
prudhvigodithi:assert
Open

Reduce lock contention in UsageTrackingQueryCachingPolicy#16306
prudhvigodithi wants to merge 2 commits into
apache:mainfrom
prudhvigodithi:assert

Conversation

@prudhvigodithi

Copy link
Copy Markdown
Contributor

Description

After split LRUQueryCache into 16 partitions with separate locks, concurrent cache insertions no longer wait for each other. UsageTrackingQueryCachingPolicy still does, every onUse() and frequency() call funnels through one shared synchronized (this) block. This PR replaces the single FrequencyTrackingRingBuffer field with 16 independent ring buffers, partitioned by hash code.

Benchmark Baseline (M ops/s) Candidate (M ops/s) Δ throughput
singleThread_onUse 18.5 14.1 −24%
singleThread_shouldCache 26.9 23.5 −13%
concurrent_uniform_4t 7.8 13.3 +70%
concurrent_uniform_8t 8.5 17.1 +101%
concurrent_uniform_16t 8.5 16.4 +93%
concurrent_uniform_32t 8.6 16.4 +90%
concurrent_mixed_zipf_16t 9.3 16.9 +82%
concurrent_mixed_zipf_32t 9.6 16.7 +73%

@prudhvigodithi
prudhvigodithi force-pushed the assert branch 2 times, most recently from a02f13a to 8190057 Compare June 30, 2026 13:47
@github-actions github-actions Bot added this to the 10.6.0 milestone Jun 30, 2026
@prudhvigodithi
prudhvigodithi force-pushed the assert branch 2 times, most recently from b92b390 to f9cfc32 Compare June 30, 2026 15:10
Signed-off-by: Prudhvi Godithi <pgodithi@amazon.com>
@github-actions

Copy link
Copy Markdown
Contributor

This PR has not had activity in the past 2 weeks, labeling it as stale. If the PR is waiting for review, notify the dev@lucene.apache.org list. Thank you for your contribution!

@github-actions github-actions Bot added the Stale label Jul 15, 2026
Signed-off-by: Prudhvi Godithi <pgodithi@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant