Re: [PR] Load: Add WritePointRateLimiter to control load writing point rate [iotdb]

2024-05-06 Thread via GitHub


Caideyipi commented on code in PR #12356:
URL: https://github.com/apache/iotdb/pull/12356#discussion_r1590868276


##
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/LoadTsFileRateLimiter.java:
##
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.queryengine.execution.load;
+
+import org.apache.iotdb.db.conf.IoTDBConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+
+import com.google.common.util.concurrent.RateLimiter;
+
+public class LoadTsFileRateLimiter {
+
+  private static final IoTDBConfig CONFIG = 
IoTDBDescriptor.getInstance().getConfig();
+
+  private RateLimiter loadWriteRateLimiter;
+
+  private double throughoutMbPerSec = 
CONFIG.getLoadWriteThroughputMbPerSecond();
+
+  public LoadTsFileRateLimiter() {
+loadWriteRateLimiter = RateLimiter.create(throughoutMbPerSec);
+  }
+
+  private void setWritePointRate(final double throughoutMbPerSec) {
+double throughout = throughoutMbPerSec * 1024.0 * 1024.0;
+// if throughout = 0, disable rate limiting
+if (throughout <= 0) {
+  throughout = Double.MAX_VALUE;

Review Comment:
   And maybe this means "throughput" too.



-- 
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-unsubscr...@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



Re: [PR] Load: Add WritePointRateLimiter to control load writing point rate [iotdb]

2024-05-06 Thread via GitHub


Caideyipi commented on code in PR #12356:
URL: https://github.com/apache/iotdb/pull/12356#discussion_r1590841482


##
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/LoadTsFileRateLimiter.java:
##
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.queryengine.execution.load;
+
+import org.apache.iotdb.db.conf.IoTDBConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+
+import com.google.common.util.concurrent.RateLimiter;
+
+public class LoadTsFileRateLimiter {
+
+  private static final IoTDBConfig CONFIG = 
IoTDBDescriptor.getInstance().getConfig();
+
+  private RateLimiter loadWriteRateLimiter;
+
+  private double throughoutMbPerSec = 
CONFIG.getLoadWriteThroughputMbPerSecond();

Review Comment:
   Does it mean "throughput"?



##
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/LoadTsFileRateLimiter.java:
##
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iotdb.db.queryengine.execution.load;
+
+import org.apache.iotdb.db.conf.IoTDBConfig;
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+
+import com.google.common.util.concurrent.RateLimiter;
+
+public class LoadTsFileRateLimiter {
+
+  private static final IoTDBConfig CONFIG = 
IoTDBDescriptor.getInstance().getConfig();
+
+  private RateLimiter loadWriteRateLimiter;
+
+  private double throughoutMbPerSec = 
CONFIG.getLoadWriteThroughputMbPerSecond();
+
+  public LoadTsFileRateLimiter() {
+loadWriteRateLimiter = RateLimiter.create(throughoutMbPerSec);
+  }
+
+  private void setWritePointRate(final double throughoutMbPerSec) {
+double throughout = throughoutMbPerSec * 1024.0 * 1024.0;
+// if throughout = 0, disable rate limiting
+if (throughout <= 0) {
+  throughout = Double.MAX_VALUE;

Review Comment:
   ..



##
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/scheduler/load/LoadTsFileScheduler.java:
##
@@ -141,6 +143,7 @@ public LoadTsFileScheduler(
 this.allReplicaSets = new HashSet<>();
 this.isGeneratedByPipe = isGeneratedByPipe;
 this.block = 
LoadTsFileMemoryManager.getInstance().allocateDataCacheMemoryBlock();
+this.loadTsFileRateLimiter = new LoadTsFileRateLimiter();

Review Comment:
   Make the limiter private per scheduler may not be of use because the 
scheduler is created per statement. It is maybe ideal to make a public static 
one in loadTsFileManager and use that.



##
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/execution/load/LoadTsFileRateLimiter.java:
##
@@ -0,0 +1,65 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * 

[PR] Load: Add WritePointRateLimiter to control load writing point rate [iotdb]

2024-04-16 Thread via GitHub


MiniSho opened a new pull request, #12356:
URL: https://github.com/apache/iotdb/pull/12356

   ## Description
   LoadTsFileRateLimiter is a global singleton, and control the load writing 
point rate at 2 places:
   1. The second phase of Two-phase Commit: After loading the tsfilePiecesNode
   2. Load the tsfile which does not need to be decoded


-- 
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-unsubscr...@iotdb.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org