liutang123 commented on code in PR #46959:
URL: https://github.com/apache/doris/pull/46959#discussion_r1916075734


##########
fe/fe-core/src/main/java/org/apache/doris/catalog/TabletStatMgr.java:
##########
@@ -43,12 +43,24 @@
 public class TabletStatMgr extends MasterDaemon {
     private static final Logger LOG = 
LogManager.getLogger(TabletStatMgr.class);
 
-    private ForkJoinPool taskPool = new 
ForkJoinPool(Runtime.getRuntime().availableProcessors());
+    private ForkJoinPool taskPool = new ForkJoinPool(Math.max(8, 
Runtime.getRuntime().availableProcessors()));
 
     public TabletStatMgr() {
         super("tablet stat mgr", Config.tablet_stat_update_interval_second * 
1000);
     }
 
+    private ForkJoinPool adjustThreadPool(int backendSize) {
+        int minimunParallelism = Math.max(8, 
Runtime.getRuntime().availableProcessors());
+        int maximunParallelism = 64;
+        int newParallelism = Math.min(backendSize, maximunParallelism);
+        newParallelism = Math.max(newParallelism, minimunParallelism);
+        newParallelism = (newParallelism + 7) / 8 * 8; // Round up to the 
multiple of 8
+        if (taskPool == null || taskPool.getParallelism() != newParallelism) {
+            return new ForkJoinPool(newParallelism);

Review Comment:
   1. We can pass a `ForkJoinWorkerThreadFactory` to `ForkJoinPool` to specify 
the forkjoin thread name.
   2. If we renew a `ForkJoinPool` and the `taskPool` is not null, we should 
shutdown the `taskPool`.



-- 
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