You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "Pengzna (via GitHub)" <gi...@apache.org> on 2025/08/13 03:18:24 UTC
[PR] Use global sink executor pool for IoTV2 [iotdb]
Pengzna opened a new pull request, #16163:
URL: https://github.com/apache/iotdb/pull/16163
As IoTV2's sink num is equals to data regions num, and data regions num is limited and strictly controlled, there is no need for IoTV2 to use separate executor pool for each sink, which may cause threads booming.
So we use global singleton executor pool for all of IoTV2 sinks.
Use fixedThreadPool here, and its core size is carefully set to Min(core num, data region soft limit).
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use global sink executor pool for IoTV2 [iotdb]
Posted by "Pengzna (via GitHub)" <gi...@apache.org>.
Pengzna commented on code in PR #16163:
URL: https://github.com/apache/iotdb/pull/16163#discussion_r2308915639
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/PipeConsensusSubtaskExecutor.java:
##########
@@ -27,12 +27,17 @@ public class PipeConsensusSubtaskExecutor extends PipeSinkSubtaskExecutor {
public PipeConsensusSubtaskExecutor() {
super(
// 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
+ // in order to ensure multi-cores performance, the number of data regions usually does not
Review Comment:
you are right!
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use global sink executor pool for IoTV2 [iotdb]
Posted by "Caideyipi (via GitHub)" <gi...@apache.org>.
Caideyipi commented on code in PR #16163:
URL: https://github.com/apache/iotdb/pull/16163#discussion_r2271980396
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSinkStage.java:
##########
@@ -59,7 +61,11 @@ protected void registerSubtask() {
this.connectorSubtaskId =
PipeSinkSubtaskManager.instance()
.register(
- executor,
+ // IoTV2 uses global singleton executor pool.
+ pipeName.startsWith(PipeStaticMeta.CONSENSUS_PIPE_PREFIX)
+ ? (PipeSinkSubtaskExecutor)
+ IoTV2GlobalComponentContainer.getInstance().getConsensusExecutor()
+ : executor.get(),
Review Comment:
Do not get here... A normal sink executor has an increasing ID, thus you shall only get when you really need it
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use global sink executor pool for IoTV2 [iotdb]
Posted by "Caideyipi (via GitHub)" <gi...@apache.org>.
Caideyipi commented on code in PR #16163:
URL: https://github.com/apache/iotdb/pull/16163#discussion_r2271981271
##########
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:
May this be directly configurable?
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java:
##########
@@ -118,9 +118,7 @@ public PipeDataNodeTask build() {
pipeStaticMeta.getCreationTime(),
connectorParameters,
regionId,
- pipeType.equals(PipeType.USER)
- ? PipeSubtaskExecutorManager.getInstance().getConnectorExecutorSupplier()
- : PipeSubtaskExecutorManager.getInstance().getConsensusExecutorSupplier());
+ PipeSubtaskExecutorManager.getInstance().getConnectorExecutorSupplier());
Review Comment:
Why not write your codes here?
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSinkStage.java:
##########
@@ -59,7 +61,11 @@ protected void registerSubtask() {
this.connectorSubtaskId =
PipeSinkSubtaskManager.instance()
.register(
- executor,
+ // IoTV2 uses global singleton executor pool.
+ pipeName.startsWith(PipeStaticMeta.CONSENSUS_PIPE_PREFIX)
+ ? (PipeSinkSubtaskExecutor)
+ IoTV2GlobalComponentContainer.getInstance().getConsensusExecutor()
+ : executor.get(),
Review Comment:
Do not get here... A normal sink has an increasing ID, thus you shall only get when you really need it
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use global sink executor pool for IoTV2 [iotdb]
Posted by "Pengzna (via GitHub)" <gi...@apache.org>.
Pengzna commented on code in PR #16163:
URL: https://github.com/apache/iotdb/pull/16163#discussion_r2292524182
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/stage/PipeTaskSinkStage.java:
##########
@@ -59,7 +61,11 @@ protected void registerSubtask() {
this.connectorSubtaskId =
PipeSinkSubtaskManager.instance()
.register(
- executor,
+ // IoTV2 uses global singleton executor pool.
+ pipeName.startsWith(PipeStaticMeta.CONSENSUS_PIPE_PREFIX)
+ ? (PipeSinkSubtaskExecutor)
+ IoTV2GlobalComponentContainer.getInstance().getConsensusExecutor()
+ : executor.get(),
Review Comment:
fixed.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/agent/task/builder/PipeDataNodeTaskBuilder.java:
##########
@@ -118,9 +118,7 @@ public PipeDataNodeTask build() {
pipeStaticMeta.getCreationTime(),
connectorParameters,
regionId,
- pipeType.equals(PipeType.USER)
- ? PipeSubtaskExecutorManager.getInstance().getConnectorExecutorSupplier()
- : PipeSubtaskExecutorManager.getInstance().getConsensusExecutorSupplier());
+ PipeSubtaskExecutorManager.getInstance().getConnectorExecutorSupplier());
Review Comment:
fixed
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use global sink executor pool for IoTV2 [iotdb]
Posted by "Pengzna (via GitHub)" <gi...@apache.org>.
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use global sink executor pool for IoTV2 [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 merged PR #16163:
URL: https://github.com/apache/iotdb/pull/16163
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Use global sink executor pool for IoTV2 [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 commented on code in PR #16163:
URL: https://github.com/apache/iotdb/pull/16163#discussion_r2302707093
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/pipe/consensus/PipeConsensusSubtaskExecutor.java:
##########
@@ -27,12 +27,17 @@ public class PipeConsensusSubtaskExecutor extends PipeSinkSubtaskExecutor {
public PipeConsensusSubtaskExecutor() {
super(
// 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
+ // in order to ensure multi-cores performance, the number of data regions usually does not
Review Comment:
I suppose `multi-core` is correct.
You call something a multi-player game instead of multi-players game, right?
--
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: reviews-unsubscribe@iotdb.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org