Skip to content

Suggestion about LRUQueryCache Optimization #13318

@boicehuang

Description

@boicehuang

Description

https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java#L747

Can we use ReentrantReadWriteLock in LRUQueryCache (Currently ReentrantLock) to allow reading cache concurrently, to improve search performance?

I benchmarked this optimization by mocking some random LongPoint and querying them with PointInSetQuery with bool filter.

doc count field cardinality query point baseline QPS candidate QPS diff percentage
30000000 10 1 2481 5102 105.6%
30000000 1000000 1 6396 6596.48 3.1%

I think this change can help filter queries that need to query low-cardinality fields. If it helps, I will submit a PR.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions