Pengzna commented on code in PR #16163:
URL: https://github.com/apache/iotdb/pull/16163#discussion_r2292542654
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/PipeConsensusSubtaskExecutor.java:
##########
@@ -19,18 +19,25 @@
package org.apache.iotdb.db.pipe.consensus;
import org.apache.iotdb.commons.concurrent.ThreadName;
-import org.apache.iotdb.commons.pipe.config.PipeConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.pipe.agent.task.execution.PipeSinkSubtaskExecutor;
-
-import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.iotdb.db.storageengine.dataregion.DataRegion;
public class PipeConsensusSubtaskExecutor extends PipeSinkSubtaskExecutor {
-
- private static final AtomicInteger id = new AtomicInteger(0);
-
public PipeConsensusSubtaskExecutor() {
super(
- PipeConfig.getInstance().getPipeSubtaskExecutorMaxThreadNum(),
- ThreadName.PIPE_CONSENSUS_EXECUTOR_POOL + "-" + id.getAndIncrement());
+ // The number of data regions for a datanode is limited by
offHeapMemory. At the same time,
+ // in order to ensure multi-core performance, the number of data
regions usually does not
+ // exceed the number of cores. To prevent the thread from exploding,
we take the min of
+ // both.
+ (int)
+ Math.min(
+ Runtime.getRuntime().availableProcessors(),
+ IoTDBDescriptor.getInstance()
+ .getMemoryConfig()
+ .getOffHeapMemoryManager()
+ .getTotalMemorySizeInBytes()
+ / DataRegion.getAcquireDirectBufferMemCost()),
Review Comment:
i think there is no need to configure this.
1. users may not aware of this configuration and I think most users have no
idea for configuring this.
2. the soft limit of data region can be approximated, that we just set core
size to this soft limit is fine.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/PipeConsensusSubtaskExecutor.java:
##########
@@ -19,18 +19,25 @@
package org.apache.iotdb.db.pipe.consensus;
import org.apache.iotdb.commons.concurrent.ThreadName;
-import org.apache.iotdb.commons.pipe.config.PipeConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
import org.apache.iotdb.db.pipe.agent.task.execution.PipeSinkSubtaskExecutor;
-
-import java.util.concurrent.atomic.AtomicInteger;
+import org.apache.iotdb.db.storageengine.dataregion.DataRegion;
public class PipeConsensusSubtaskExecutor extends PipeSinkSubtaskExecutor {
-
- private static final AtomicInteger id = new AtomicInteger(0);
-
public PipeConsensusSubtaskExecutor() {
super(
- PipeConfig.getInstance().getPipeSubtaskExecutorMaxThreadNum(),
- ThreadName.PIPE_CONSENSUS_EXECUTOR_POOL + "-" + id.getAndIncrement());
+ // The number of data regions for a datanode is limited by
offHeapMemory. At the same time,
+ // in order to ensure multi-core performance, the number of data
regions usually does not
+ // exceed the number of cores. To prevent the thread from exploding,
we take the min of
+ // both.
+ (int)
+ Math.min(
+ Runtime.getRuntime().availableProcessors(),
+ IoTDBDescriptor.getInstance()
+ .getMemoryConfig()
+ .getOffHeapMemoryManager()
+ .getTotalMemorySizeInBytes()
+ / DataRegion.getAcquireDirectBufferMemCost()),
Review Comment:
I think there is no need to configure this.
1. users may not aware of this configuration and I think most users have no
idea for configuring this.
2. the soft limit of data region can be approximated, that we just set core
size to this soft limit is fine.
--
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]