Skip to content

[IOTDB-2807]Speed up the cross space compaction by multi-threads#5415

Merged
qiaojialin merged 19 commits intoapache:masterfrom
choubenson:speedUpCompaction
Apr 9, 2022
Merged

[IOTDB-2807]Speed up the cross space compaction by multi-threads#5415
qiaojialin merged 19 commits intoapache:masterfrom
choubenson:speedUpCompaction

Conversation

@choubenson
Copy link
Contributor

The cross space comapction execution performance of 0.13.0 is slower than 0.12.5.

Need to speed up.

We achieve parallel reading and writing at the measurement level by adding threads.

try {
futures.get(i).get();
} catch (InterruptedException | ExecutionException e) {
logger.error("SubCompactionTask meet errors ", e);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thread.interrepted().

Copy link
Contributor

@THUMarkLau THUMarkLau left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to have a performance report for this PR before it is merged?

} catch (PathNotExistException e) {
logger.info("A deleted path is skipped: {}", e.getMessage());
continue;
if (measurementsForEachSubTask[idx % subTaskNums] == null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it necessary to hash here? If the hash is not uniform, then the effect of multithreading could not be worse. Why not just use a concurrency stack or queue, each sub-thread get a measurement to compact when it is available.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each sub task has its own hashset, so this won't happen.

} catch (InterruptedException | ExecutionException e) {
logger.error("SubCompactionTask meet errors ", e);
Thread.interrupted();
throw new IOException(e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Throw a InterruptedException instead.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

int fileIndex = seqFileIndexArray[subTaskId];
writeRateLimit(chunkWriterMap.get(subTaskId).estimateMaxSeriesMemSize());
while (hasTargetFileStartChunkGroup[fileIndex].get() == 1) {
// wait until the target file has finished flushing chunk group header
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait and notifyall

out.flush();
}

public void truncate(long truncateSize) throws IOException {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
public void truncate(long truncateSize) throws IOException {
public void truncate(long offset) throws IOException {

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Resolved

@qiaojialin qiaojialin merged commit 99c824f into apache:master Apr 9, 2022
xinzhongtianxia pushed a commit to xinzhongtianxia/iotdb that referenced this pull request Apr 11, 2022
…er_meta

* remotes/upstream/master:
  [IOTDB-2872] Rename vsg to dataRegion (apache#5470)
  [IOTDB-2806][InfluxDB] Compatibility of Apache IoTDB with InfluxDB - Complete UserGuide (apache#5351)
  [IOTDB-2658] Generate logical plan for query statement  —— UT & Raw Data Query & Aggregation Query (apache#5469)
  [IOTDB-1614] New WAL (apache#5320)
  Update ContributeGuide.md (apache#5463)
  user SerializeDeserializeUtil in confignode/AuthorPlan (apache#5467)
  Modify the jdbc query time column to be empty (apache#5281)
  [IOTDB-2827] Batch insert in new cluster (apache#5412)
  [IOTDB-2801] New storage engine framework (apache#5357)
  [IOTDB-2807]Speed up the cross space compaction by multi-threads (apache#5415)
  Fix coverage check
  [IOTDB-2864] Fix Read-only occurred when insert Text values to aligned timeseries (apache#5460)
  [IOTDB-2803]add AlterTimeSeriesNode and CreateAlignedTimeSeriesNode to PlanNodeType and its serialize and deserialize (apache#5444)
  [IOTDB-2841] add permission manager model (apache#5401)

# Conflicts:
#	server/src/main/java/org/apache/iotdb/db/mpp/sql/analyze/Analyzer.java
#	server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/DistributionPlanner.java
#	server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/LogicalPlanner.java
#	server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/PlanFragment.java
#	server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/PlanNodeType.java
#	server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/metedata/read/DevicesMetaScanNode.java
#	server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/source/SeriesScanNode.java
#	server/src/main/java/org/apache/iotdb/db/mpp/sql/planner/plan/node/source/SourceNode.java
#	server/src/main/java/org/apache/iotdb/db/mpp/sql/statement/StatementVisitor.java
#	server/src/test/java/org/apache/iotdb/db/mpp/sql/plan/LogicalPlannerTest.java
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants