You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by "sgup432 (via GitHub)" <gi...@apache.org> on 2025/01/29 23:51:32 UTC
[I] Allow skip_factor to be set dynamically within QueryCache [lucene]
sgup432 opened a new issue, #14183:
URL: https://github.com/apache/lucene/issues/14183
### Description
I see there have been many discussions around finding the right value for skip_factor ([here](https://issues.apache.org/jira/browse/LUCENE-9002) and https://github.com/apache/lucene/issues/11081), mostly the concern being that caching large query clauses(as per their cost and eventually size) may not make much sense, considering they will make the overall query slow due to cache overhead(locks, eviction).
In follow up to this issue - https://github.com/apache/lucene/issues/14028, I see by relaxing `skip_factor` limits, one was able to utilize query cache in a much better way and improve performance. As of today, one can only change this during cache creation [here](https://github.com/apache/lucene/blob/main/lucene/core/src/java/org/apache/lucene/search/LRUQueryCache.java#L124) and not dynamically.
Can we allow this to be set dynamically within QueryCache, enabling users to increase or decrease it as needed during runtime? It seems like a harmless change and could be quite useful.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "sgup432 (via GitHub)" <gi...@apache.org>.
sgup432 commented on issue #14183:
URL: https://github.com/apache/lucene/issues/14183#issuecomment-2686255847
>OK. Would you like to open a PR?
Sure.
>For reference, I have been separately looking into reducing the importance of the cache for good query performance and plan on making it disabled by default in the future. https://github.com/apache/lucene/pull/14187
That is sad. I had opened another issue [here](https://github.com/apache/lucene/issues/14222) basically proposing changing the key structure to improve write/read throughput. And doing stale key clean up(ie stale segments) in an async manner on a different thread.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "sgup432 (via GitHub)" <gi...@apache.org>.
sgup432 commented on issue #14183:
URL: https://github.com/apache/lucene/issues/14183#issuecomment-2625661420
@jpountz Yeah I meant we could use something like AtomicReference to set it dynamically in a thread safe way.
I meant harmless in a sense that it should be easy to implement via getter/setter.
Something like below:
```
private final AtomicReference<Float> skipCacheFactor = new AtomicReference<>(10f);
public float getSkipCacheFactor() {
return skipCacheFactor.get();
}
public void setSkipCacheFactor(float value) {
skipCacheFactor.set(value);
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "sgup432 (via GitHub)" <gi...@apache.org>.
sgup432 commented on issue #14183:
URL: https://github.com/apache/lucene/issues/14183#issuecomment-2625954720
@jpountz If you think it is feasible via above approach, I can quickly raise a PR on this with some UTs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "sgup432 (via GitHub)" <gi...@apache.org>.
sgup432 commented on issue #14183:
URL: https://github.com/apache/lucene/issues/14183#issuecomment-2629157954
We're considering adjusting the skip_factor limits dynamically to optimize query cache usage when needed, especially when it's underutilized. By exposing this as a dynamic cluster setting in OpenSearch, we can adjust the skip_factor value based on query cache utilization. We've received feedback from several users/customers who have expressed concerns that the query cache isn't being fully utilized in their domain, unlike in previous versions where the skip_factor was set to a higher default.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "sgup432 (via GitHub)" <gi...@apache.org>.
sgup432 closed issue #14183: Allow skip_factor to be set dynamically within QueryCache
URL: https://github.com/apache/lucene/issues/14183
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "sgup432 (via GitHub)" <gi...@apache.org>.
sgup432 commented on issue #14183:
URL: https://github.com/apache/lucene/issues/14183#issuecomment-2686285414
>Why do you find it sad?
It has more with the timing, as I was personally looking into improving the query cache performance. 😁
I think its still pretty useful if done well. It isn't performant mainly due to its key structure as it doesn't allow N threads to write concurrently, affecting its read performance and eventually skipping the cache altogether. There are other stuff as well which can be done better.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "sgup432 (via GitHub)" <gi...@apache.org>.
sgup432 commented on issue #14183:
URL: https://github.com/apache/lucene/issues/14183#issuecomment-2679778282
@jpountz Just checking if you’ve had a chance to look into this. As mentioned, I believe dynamically adjusting `skip_factor` would be beneficial. Additionally, we can also introduce a simple counter to track how often we skip caching an item due to `skip_factor`. This could help in fine-tuning the adjustment.
We can also try thinking to expose this via QueryCachingPolicy, but with a change where a user can dynamically update the parameters like `skip_factor` or others via their own implementation without polluting the core `LRUQueryCache` code.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "jpountz (via GitHub)" <gi...@apache.org>.
jpountz commented on issue #14183:
URL: https://github.com/apache/lucene/issues/14183#issuecomment-2686261007
Why do you find it sad?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "jpountz (via GitHub)" <gi...@apache.org>.
jpountz commented on issue #14183:
URL: https://github.com/apache/lucene/issues/14183#issuecomment-2625648861
I am not entirely sure about the "harmless" part: this class is shared by multiple threads so we would need to make sure that the value is updated in a thread-safe way.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "jpountz (via GitHub)" <gi...@apache.org>.
jpountz commented on issue #14183:
URL: https://github.com/apache/lucene/issues/14183#issuecomment-2686219104
OK. Would you like to open a PR?
For reference, I have been separately looking into reducing the importance of the cache for good query performance and plan on making it disabled by default in the future. #14187
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "jpountz (via GitHub)" <gi...@apache.org>.
jpountz commented on issue #14183:
URL: https://github.com/apache/lucene/issues/14183#issuecomment-2629028239
In general I'm not a fan of exposing tuning knobs just because we can expose them. Deciding when a clause is worth caching feels like something that Lucene is the right decision maker for, rather than the application. Maybe you can share more about how you plan on tuning this knob?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org
Re: [I] Allow skip_factor to be set dynamically within QueryCache [lucene]
Posted by "kkewwei (via GitHub)" <gi...@apache.org>.
kkewwei commented on issue #14183:
URL: https://github.com/apache/lucene/issues/14183#issuecomment-2629365142
In query-sensitive scenarios, the dataset is very small, there is ample remaining memory space. Users even want to cache all queries in memory, however this cannot be achieved due to the skip_factor. It seems better if users could adjust it according to their needs.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org