benwtrent commented on code in PR #13124: URL: https://github.com/apache/lucene/pull/13124#discussion_r1502163736
########## lucene/core/src/java/org/apache/lucene/index/ConcurrentMergeScheduler.java: ########## @@ -910,4 +936,58 @@ public void setSuppressExceptions(ConcurrentMergeScheduler cms) { } }); } + + private class ScaledExecutor extends ThreadPoolExecutor { + + AtomicInteger activeCount = new AtomicInteger(0); + + public ScaledExecutor() { + super( + Math.max(0, maxThreadCount - 1), + Math.max(1, maxThreadCount - 1), + Long.MAX_VALUE, + TimeUnit.NANOSECONDS, + new SynchronousQueue<>()); + } Review Comment: > Thinking out loud: for the case when tens of index writers are open in the same JVM, we may want to configure a timeout on threads in order to avoid spending too much heap on idle threads? The timeout would only apply to non-core threads. But, your point is taken, it is possible for merges to be idle for a while and we don't want threads just sitting around taking up unnecessary space. So, I can make `core` always `0`, and rely on the pool dynamically adding threads up to max. -- 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-unsubscr...@lucene.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@lucene.apache.org For additional commands, e-mail: issues-h...@lucene.apache.org