You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@solr.apache.org by "tpunder (via GitHub)" <gi...@apache.org> on 2023/08/22 23:04:59 UTC
[GitHub] [solr] tpunder commented on a diff in pull request #1861: SOLR-16945: Add multi-threaded warming support for CaffeineCache and QuerySenderListener
tpunder commented on code in PR #1861:
URL: https://github.com/apache/solr/pull/1861#discussion_r1302272877
##########
solr/core/src/java/org/apache/solr/core/QuerySenderListener.java:
##########
@@ -44,65 +53,131 @@ public QuerySenderListener(SolrCore core) {
@Override
public void newSearcher(SolrIndexSearcher newSearcher, SolrIndexSearcher currentSearcher) {
+ final long startTimeNanos = System.nanoTime();
+
final SolrIndexSearcher searcher = newSearcher;
log.debug("QuerySenderListener sending requests to {}", newSearcher);
@SuppressWarnings("unchecked")
List<NamedList<Object>> allLists =
convertQueriesToList((ArrayList<Object>) getArgs().getAll("queries"));
if (allLists == null) return;
- for (NamedList<Object> nlst : allLists) {
+ final int threads = getThreadsParam();
+
+ if (0 == threads || 1 == threads || allLists.isEmpty()) { // Non-threaded code path
+ for (NamedList<Object> nlst : allLists) {
+ runQuery(newSearcher, currentSearcher, nlst);
+ }
+ } else { // Multi-threaded code path
+ final int nThreads = threads > 0 ? threads : Runtime.getRuntime().availableProcessors();
Review Comment:
My intent is that negative numbers will default to using the number of available processors. However, I originally was not catching `0 == threads` but later decided that it made more sense to treat `0 == threads` as meaning "no threading". That behavior seems more consistent with the `facet.threads` parameter which has the similar behavior for a value of 0 and negative values.
--
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@solr.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@solr.apache.org
For additional commands, e-mail: issues-help@solr.apache.org