hongkunxu commented on code in PR #18047:
URL: https://github.com/apache/pinot/pull/18047#discussion_r3025616254


##########
pinot-core/src/main/java/org/apache/pinot/core/query/scheduler/resources/ResourceManager.java:
##########
@@ -85,20 +102,94 @@ public ResourceManager(PinotConfiguration config) {
     ThreadFactory queryRunnerFactory = new 
TracedThreadFactory(QUERY_RUNNER_THREAD_PRIORITY, false,
         CommonConstants.ExecutorService.PINOT_QUERY_RUNNER_NAME_FORMAT);
 
-    ExecutorService runnerService = 
Executors.newFixedThreadPool(_numQueryRunnerThreads, queryRunnerFactory);
-    runnerService = ThrottleOnCriticalHeapUsageExecutor.maybeWrap(
-        runnerService, config, "query runner");
+    _queryRunnerPool = (ThreadPoolExecutor) 
Executors.newFixedThreadPool(_numQueryRunnerThreads, queryRunnerFactory);
+    ExecutorService runnerService = 
ThrottleOnCriticalHeapUsageExecutor.maybeWrap(
+        _queryRunnerPool, config, "query runner");
     _queryRunners = MoreExecutors.listeningDecorator(runnerService);
 
     // pqw -> pinot query workers
     ThreadFactory queryWorkersFactory = new 
TracedThreadFactory(Thread.NORM_PRIORITY, false,
         CommonConstants.ExecutorService.PINOT_QUERY_WORKER_NAME_FORMAT);
-    ExecutorService workerService = 
Executors.newFixedThreadPool(_numQueryWorkerThreads, queryWorkersFactory);
-    workerService = ThrottleOnCriticalHeapUsageExecutor.maybeWrap(
-        workerService, config, "query worker");
+    _queryWorkerPool = (ThreadPoolExecutor) 
Executors.newFixedThreadPool(_numQueryWorkerThreads, queryWorkersFactory);
+    ExecutorService workerService = 
ThrottleOnCriticalHeapUsageExecutor.maybeWrap(
+        _queryWorkerPool, config, "query worker");
     _queryWorkers = MoreExecutors.listeningDecorator(workerService);
   }
 
+  /**
+   * Dynamically resizes the query runner and worker thread pools. Resizing is 
performed on the underlying
+   * {@link ThreadPoolExecutor} instances, which is transparent to any 
decorator wrappers.
+   *
+   * @param newRunnerThreads desired number of query runner threads (must be 
> 0)
+   * @param newWorkerThreads desired number of query worker threads (must be 
> 0)
+   */
+  public void resizeThreadPools(int newRunnerThreads, int newWorkerThreads) {

Review Comment:
   good advice



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to