You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@iotdb.apache.org by "shuwenwei (via GitHub)" <gi...@apache.org> on 2024/04/10 03:52:05 UTC
[PR] Compaction rate limit [iotdb]
shuwenwei opened a new pull request, #12312:
URL: https://github.com/apache/iotdb/pull/12312
## Description
1. add config items 'compaction_read_throughput_mb_per_sec' and 'compaction_read_operation_per_sec'.
2. CompactionScheduler and RepairData is constrained by these config items
3. reimplement compaction write rate 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] Compaction rate limit [iotdb]
Posted by "shuwenwei (via GitHub)" <gi...@apache.org>.
shuwenwei commented on code in PR #12312:
URL: https://github.com/apache/iotdb/pull/12312#discussion_r1565292050
##########
iotdb-core/node-commons/src/assembly/resources/conf/iotdb-common.properties:
##########
@@ -649,6 +649,16 @@ data_replication_factor=1
# Datatype: int
# compaction_write_throughput_mb_per_sec=16
+# The limit of read throughput merge can reach per second
+# values less than or equal to 0 means no limit
+# Datatype: int
+# compaction_read_throughput_mb_per_sec=40
Review Comment:
The parameter `compaction_write_throughtput_mb_per_sec` has existed in past version and been used extensively. To ensure consistent name style, the parameter is `compaction_read_throughput_mb_per_sec`. To distinguish the unit, I think I can add the unit in comment.
--
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] Compaction rate limit [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 commented on code in PR #12312:
URL: https://github.com/apache/iotdb/pull/12312#discussion_r1566891500
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/schedule/CompactionTaskManager.java:
##########
@@ -84,17 +84,19 @@ public class CompactionTaskManager implements IService {
private final RateLimiter mergeWriteRateLimiter =
RateLimiter.create(
- IoTDBDescriptor.getInstance().getConfig().getCompactionWriteThroughputMbPerSec()
- * 1024.0
- * 1024.0);
+ config.getCompactionWriteThroughputMbPerSec() <= 0
+ ? Double.MAX_VALUE
+ : config.getCompactionWriteThroughputMbPerSec());
Review Comment:
Should the value not be multiplied by 1024*1024?
I assume its unit is MB while the RateLimiter's is Byte.
--
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] Compaction rate limit [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 commented on code in PR #12312:
URL: https://github.com/apache/iotdb/pull/12312#discussion_r1565052539
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileOutput.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.storageengine.dataregion.compaction.io;
+
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.storageengine.dataregion.compaction.schedule.CompactionTaskManager;
+import org.apache.iotdb.tsfile.write.writer.TsFileOutput;
+
+import com.google.common.util.concurrent.RateLimiter;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+public class CompactionTsFileOutput extends OutputStream implements TsFileOutput {
+
+ private TsFileOutput output;
+ private RateLimiter rateLimiter = CompactionTaskManager.getInstance().getMergeWriteRateLimiter();
+ private final long maxSizePerWrite;
+
+ public CompactionTsFileOutput(TsFileOutput output) {
+ this.output = output;
+ maxSizePerWrite =
+ (int)
+ (rateLimiter.getRate()
+ / IoTDBDescriptor.getInstance().getConfig().getCompactionThreadCount());
Review Comment:
Similarly, the flexibility can be increased by putting the parameter in the constructor.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileOutput.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.storageengine.dataregion.compaction.io;
+
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.storageengine.dataregion.compaction.schedule.CompactionTaskManager;
+import org.apache.iotdb.tsfile.write.writer.TsFileOutput;
+
+import com.google.common.util.concurrent.RateLimiter;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+public class CompactionTsFileOutput extends OutputStream implements TsFileOutput {
+
+ private TsFileOutput output;
+ private RateLimiter rateLimiter = CompactionTaskManager.getInstance().getMergeWriteRateLimiter();
Review Comment:
I would suggest this be a parameter in the constructor to enable finer granularity control in the future, e.g., different databases (of different users) may have their own resource allocation and thus different rate limits.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBConfig.java:
##########
@@ -687,6 +687,12 @@ public class IoTDBConfig {
/** The limit of compaction merge can reach per second */
private int compactionWriteThroughputMbPerSec = 16;
+ /** The limit of compaction read throughput can reach per second */
+ private int compactionReadThroughputMbPerSec = 40;
Review Comment:
Mb or MB? They are quite different.
If you are concerned with the naming rule (which discourages you from using 3 or more consecutive capitalized letters), you may use something like "compactionWriteThroughputMegaBytePerSec".
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileOutput.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.storageengine.dataregion.compaction.io;
+
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.storageengine.dataregion.compaction.schedule.CompactionTaskManager;
+import org.apache.iotdb.tsfile.write.writer.TsFileOutput;
+
+import com.google.common.util.concurrent.RateLimiter;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+public class CompactionTsFileOutput extends OutputStream implements TsFileOutput {
+
+ private TsFileOutput output;
+ private RateLimiter rateLimiter = CompactionTaskManager.getInstance().getMergeWriteRateLimiter();
+ private final long maxSizePerWrite;
+
+ public CompactionTsFileOutput(TsFileOutput output) {
+ this.output = output;
+ maxSizePerWrite =
+ (int)
+ (rateLimiter.getRate()
+ / IoTDBDescriptor.getInstance().getConfig().getCompactionThreadCount());
Review Comment:
And what is the point of the parameter?
If the rate is 40MB/s, the thread count is 10, and the write size is 8MB, it is totally OK.
The write will just take 2 seconds to wait for permission.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/schedule/CompactionTaskManager.java:
##########
@@ -243,19 +255,36 @@ private boolean isTaskRunning(AbstractCompactionTask task) {
}
public RateLimiter getMergeWriteRateLimiter() {
- setWriteMergeRate(
- IoTDBDescriptor.getInstance().getConfig().getCompactionWriteThroughputMbPerSec());
return mergeWriteRateLimiter;
}
- private void setWriteMergeRate(final double throughoutMbPerSec) {
- double throughout = throughoutMbPerSec * 1024.0 * 1024.0;
+ public RateLimiter getCompactionReadRateLimiter() {
+ return compactionReadThroughputRateLimiter;
+ }
+
+ public RateLimiter getCompactionReadOperationRateLimiter() {
+ return compactionReadOperationRateLimiter;
+ }
+
+ public void setWriteMergeRate(final double throughoutMbPerSec) {
+ setRate(mergeWriteRateLimiter, throughoutMbPerSec * 1024.0 * 1024.0);
+ }
+
+ public void setCompactionReadOperationRate(final double readOperationPerSec) {
+ setRate(compactionReadOperationRateLimiter, readOperationPerSec);
+ }
+
+ public void setCompactionReadThroughputRate(final double throughputMbPerSec) {
+ setRate(compactionReadThroughputRateLimiter, throughputMbPerSec * 1024.0 * 1024.0);
+ }
+
+ private void setRate(RateLimiter rateLimiter, double rate) {
// if throughout = 0, disable rate limiting
- if (throughout <= 0) {
- throughout = Double.MAX_VALUE;
+ if (rate <= 0) {
+ rate = Double.MAX_VALUE;
}
- if (mergeWriteRateLimiter.getRate() != throughout) {
- mergeWriteRateLimiter.setRate(throughout);
+ if (rateLimiter.getRate() != rate) {
+ rateLimiter.setRate(rate);
Review Comment:
Hard to say this comparison is meaningful since the equality of two floating points may be meaningless.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java:
##########
@@ -1117,6 +1129,35 @@ private void loadCompactionHotModifiedProps(Properties properties) throws Interr
if (restartCompactionTaskManager) {
CompactionTaskManager.getInstance().restart();
}
+ // hot load compaction rate limit configurations
+
+ // update merge_write_throughput_mb_per_sec
+ conf.setCompactionWriteThroughputMbPerSec(
+ Integer.parseInt(
+ properties.getProperty(
+ "merge_write_throughput_mb_per_sec",
+ Integer.toString(conf.getCompactionWriteThroughputMbPerSec()))));
+
+ // update compaction_read_operation_per_sec
+ conf.setCompactionReadOperationPerSec(
+ Integer.parseInt(
+ properties.getProperty(
+ "compaction_read_operation_per_sec",
+ Integer.toString(conf.getCompactionReadOperationPerSec()))));
Review Comment:
Why is there no write IOPS control similar to read?
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileOutput.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.storageengine.dataregion.compaction.io;
+
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.storageengine.dataregion.compaction.schedule.CompactionTaskManager;
+import org.apache.iotdb.tsfile.write.writer.TsFileOutput;
+
+import com.google.common.util.concurrent.RateLimiter;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+public class CompactionTsFileOutput extends OutputStream implements TsFileOutput {
+
+ private TsFileOutput output;
+ private RateLimiter rateLimiter = CompactionTaskManager.getInstance().getMergeWriteRateLimiter();
+ private final long maxSizePerWrite;
+
+ public CompactionTsFileOutput(TsFileOutput output) {
+ this.output = output;
+ maxSizePerWrite =
+ (int)
+ (rateLimiter.getRate()
+ / IoTDBDescriptor.getInstance().getConfig().getCompactionThreadCount());
+ }
+
+ @Override
+ public void write(int b) throws IOException {
+ output.wrapAsStream().write(b);
+ }
+
+ @Override
+ public void write(byte[] b) throws IOException {
+ write(b, 0, b.length);
+ }
+
+ @Override
+ public void write(byte b) throws IOException {
+ output.write(b);
+ }
Review Comment:
Insignificant as it may be, the two methods with a single byte should still be controlled by the rate limiter.
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileReader.java:
##########
@@ -248,6 +250,23 @@ public void getDeviceTimeseriesMetadata(
.recordReadInfo(compactionType, CompactionIoDataType.METADATA, dataSize);
}
+ private void acquireReadDataSizeWithCompactionReadRateLimiter(long readDataSize) {
+ CompactionTaskManager.getInstance().getCompactionReadOperationRateLimiter().acquire(1);
+ while (readDataSize > 0) {
+ if (readDataSize > Integer.MAX_VALUE) {
+ CompactionTaskManager.getInstance()
+ .getCompactionReadRateLimiter()
+ .acquire(Integer.MAX_VALUE);
+ readDataSize -= Integer.MAX_VALUE;
+ } else {
+ CompactionTaskManager.getInstance()
+ .getCompactionReadRateLimiter()
+ .acquire((int) readDataSize);
+ return;
+ }
Review Comment:
Why bother checking? In line 79, where you call this function, readDataSize must be an int. Also, the IO unit cannot be long since the size of a byte[], or a ByteBuffer can never go beyond an int.
##########
iotdb-core/node-commons/src/assembly/resources/conf/iotdb-common.properties:
##########
@@ -649,6 +649,16 @@ data_replication_factor=1
# Datatype: int
# compaction_write_throughput_mb_per_sec=16
+# The limit of read throughput merge can reach per second
+# values less than or equal to 0 means no limit
+# Datatype: int
+# compaction_read_throughput_mb_per_sec=40
Review Comment:
Also, notice the difference between Mb and MB here.
--
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] Compaction rate limit [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 commented on code in PR #12312:
URL: https://github.com/apache/iotdb/pull/12312#discussion_r1566883537
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileOutput.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.storageengine.dataregion.compaction.io;
+
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.storageengine.dataregion.compaction.schedule.CompactionTaskManager;
+import org.apache.iotdb.tsfile.write.writer.TsFileOutput;
+
+import com.google.common.util.concurrent.RateLimiter;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+public class CompactionTsFileOutput extends OutputStream implements TsFileOutput {
+
+ private TsFileOutput output;
+ private RateLimiter rateLimiter = CompactionTaskManager.getInstance().getMergeWriteRateLimiter();
+ private final long maxSizePerWrite;
+
+ public CompactionTsFileOutput(TsFileOutput output) {
+ this.output = output;
+ maxSizePerWrite =
+ (int)
+ (rateLimiter.getRate()
+ / IoTDBDescriptor.getInstance().getConfig().getCompactionThreadCount());
Review Comment:
I do not see the point. What is so different between waiting for 1 second twice and 2 seconds once?
The total waiting time is not affected by the block size.
Blocking other threads is also quite normal, because you are doing RATE LIMITING and blocking is how exactly things are done.
--
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] Compaction rate limit [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 commented on code in PR #12312:
URL: https://github.com/apache/iotdb/pull/12312#discussion_r1566883537
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileOutput.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.storageengine.dataregion.compaction.io;
+
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.storageengine.dataregion.compaction.schedule.CompactionTaskManager;
+import org.apache.iotdb.tsfile.write.writer.TsFileOutput;
+
+import com.google.common.util.concurrent.RateLimiter;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+public class CompactionTsFileOutput extends OutputStream implements TsFileOutput {
+
+ private TsFileOutput output;
+ private RateLimiter rateLimiter = CompactionTaskManager.getInstance().getMergeWriteRateLimiter();
+ private final long maxSizePerWrite;
+
+ public CompactionTsFileOutput(TsFileOutput output) {
+ this.output = output;
+ maxSizePerWrite =
+ (int)
+ (rateLimiter.getRate()
+ / IoTDBDescriptor.getInstance().getConfig().getCompactionThreadCount());
Review Comment:
I do not see the point. What is so different between waiting for 1 second twice and 2 seconds once?
The total waiting time is not affected by the block size.
Blocking other threads is also quite normal because you are doing RATE LIMITING and blocking is how exactly things are done.
--
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] Compaction rate limit [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 commented on code in PR #12312:
URL: https://github.com/apache/iotdb/pull/12312#discussion_r1566891500
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/schedule/CompactionTaskManager.java:
##########
@@ -84,17 +84,19 @@ public class CompactionTaskManager implements IService {
private final RateLimiter mergeWriteRateLimiter =
RateLimiter.create(
- IoTDBDescriptor.getInstance().getConfig().getCompactionWriteThroughputMbPerSec()
- * 1024.0
- * 1024.0);
+ config.getCompactionWriteThroughputMbPerSec() <= 0
+ ? Double.MAX_VALUE
+ : config.getCompactionWriteThroughputMbPerSec());
Review Comment:
Should the value be multiplied by 1024*1024?
I assume its unit is MB while the RateLimiter's is Byte.
--
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] Compaction rate limit [iotdb]
Posted by "shuwenwei (via GitHub)" <gi...@apache.org>.
shuwenwei commented on code in PR #12312:
URL: https://github.com/apache/iotdb/pull/12312#discussion_r1565344808
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java:
##########
@@ -1117,6 +1129,35 @@ private void loadCompactionHotModifiedProps(Properties properties) throws Interr
if (restartCompactionTaskManager) {
CompactionTaskManager.getInstance().restart();
}
+ // hot load compaction rate limit configurations
+
+ // update merge_write_throughput_mb_per_sec
+ conf.setCompactionWriteThroughputMbPerSec(
+ Integer.parseInt(
+ properties.getProperty(
+ "merge_write_throughput_mb_per_sec",
+ Integer.toString(conf.getCompactionWriteThroughputMbPerSec()))));
+
+ // update compaction_read_operation_per_sec
+ conf.setCompactionReadOperationPerSec(
+ Integer.parseInt(
+ properties.getProperty(
+ "compaction_read_operation_per_sec",
+ Integer.toString(conf.getCompactionReadOperationPerSec()))));
Review Comment:
The parameter `compaction_read_operation_per_sec` intends to limit the rate of `repair data`. Its read load has some differences from the normal compaction task.
--
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] Compaction rate limit [iotdb]
Posted by "jt2594838 (via GitHub)" <gi...@apache.org>.
jt2594838 commented on code in PR #12312:
URL: https://github.com/apache/iotdb/pull/12312#discussion_r1566874193
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/conf/IoTDBDescriptor.java:
##########
@@ -1117,6 +1129,35 @@ private void loadCompactionHotModifiedProps(Properties properties) throws Interr
if (restartCompactionTaskManager) {
CompactionTaskManager.getInstance().restart();
}
+ // hot load compaction rate limit configurations
+
+ // update merge_write_throughput_mb_per_sec
+ conf.setCompactionWriteThroughputMbPerSec(
+ Integer.parseInt(
+ properties.getProperty(
+ "merge_write_throughput_mb_per_sec",
+ Integer.toString(conf.getCompactionWriteThroughputMbPerSec()))));
+
+ // update compaction_read_operation_per_sec
+ conf.setCompactionReadOperationPerSec(
+ Integer.parseInt(
+ properties.getProperty(
+ "compaction_read_operation_per_sec",
+ Integer.toString(conf.getCompactionReadOperationPerSec()))));
Review Comment:
The answer is not direct enough. How is it so different? Why is the IOPS control useless to normal compaction?
--
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] Compaction rate limit [iotdb]
Posted by "shuwenwei (via GitHub)" <gi...@apache.org>.
shuwenwei commented on code in PR #12312:
URL: https://github.com/apache/iotdb/pull/12312#discussion_r1566912069
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/schedule/CompactionTaskManager.java:
##########
@@ -84,17 +84,19 @@ public class CompactionTaskManager implements IService {
private final RateLimiter mergeWriteRateLimiter =
RateLimiter.create(
- IoTDBDescriptor.getInstance().getConfig().getCompactionWriteThroughputMbPerSec()
- * 1024.0
- * 1024.0);
+ config.getCompactionWriteThroughputMbPerSec() <= 0
+ ? Double.MAX_VALUE
+ : config.getCompactionWriteThroughputMbPerSec());
Review Comment:
It should be multiplied by 1024 * 1024. I forgot the unit in previous modification.
--
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] Compaction rate limit [iotdb]
Posted by "shuwenwei (via GitHub)" <gi...@apache.org>.
shuwenwei commented on code in PR #12312:
URL: https://github.com/apache/iotdb/pull/12312#discussion_r1565341065
##########
iotdb-core/datanode/src/main/java/org/apache/iotdb/db/storageengine/dataregion/compaction/io/CompactionTsFileOutput.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * 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.storageengine.dataregion.compaction.io;
+
+import org.apache.iotdb.db.conf.IoTDBDescriptor;
+import org.apache.iotdb.db.storageengine.dataregion.compaction.schedule.CompactionTaskManager;
+import org.apache.iotdb.tsfile.write.writer.TsFileOutput;
+
+import com.google.common.util.concurrent.RateLimiter;
+
+import java.io.IOException;
+import java.io.OutputStream;
+import java.nio.ByteBuffer;
+
+public class CompactionTsFileOutput extends OutputStream implements TsFileOutput {
+
+ private TsFileOutput output;
+ private RateLimiter rateLimiter = CompactionTaskManager.getInstance().getMergeWriteRateLimiter();
+ private final long maxSizePerWrite;
+
+ public CompactionTsFileOutput(TsFileOutput output) {
+ this.output = output;
+ maxSizePerWrite =
+ (int)
+ (rateLimiter.getRate()
+ / IoTDBDescriptor.getInstance().getConfig().getCompactionThreadCount());
Review Comment:
The write will obtain write size twice, but it won't wait because the rate is 40MB/s. This parameter intends to avoid large write blocks small write: If a thread acquired large write size in one time, other threads may be blocked for a while. However, it may split a write to many part and i'm not sure what the impact is.
Another implementation I thought is to remove `/ IoTDBDescriptor.getInstance().getConfig().getCompactionThreadCount()`.
--
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] Compaction rate limit [iotdb]
Posted by "OneSizeFitsQuorum (via GitHub)" <gi...@apache.org>.
OneSizeFitsQuorum merged PR #12312:
URL: https://github.com/apache/iotdb/pull/12312
--
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