Skip to content

Optimize pipe request serialization buffer sizing - #18233

Merged
jt2594838 merged 7 commits into
apache:masterfrom
luoluoyuyu:pipe-tablet-serialization-size
Jul 28, 2026
Merged

Optimize pipe request serialization buffer sizing#18233
jt2594838 merged 7 commits into
apache:masterfrom
luoluoyuyu:pipe-tablet-serialization-size

Conversation

@luoluoyuyu

Copy link
Copy Markdown
Member

Description


This PR has:

  • been self-reviewed.
    • concurrent read
    • concurrent write
    • concurrent read and write
  • added documentation for new or modified features or behaviors.
  • added Javadocs for most classes and all non-trivial methods.
  • added or updated version, license, or notice information
  • added comments explaining the "why" and the intent of the code wherever would not be obvious
    for an unfamiliar reader.
  • added unit tests or modified existing tests to cover new code paths, ensuring the threshold
    for code coverage.
  • added integration tests.
  • been tested in a test IoTDB cluster.

Key changed/added classes (or packages if there are too many classes) in this PR

@luoluoyuyu
luoluoyuyu force-pushed the pipe-tablet-serialization-size branch from 44dc635 to 793b0a6 Compare July 17, 2026 06:45

@jt2594838 jt2594838 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

May add some performance results.

Comment on lines +284 to +298
private static void clearDataRegionReplicaSet(final InsertRowNode insertRowNode) {
insertRowNode.setDataRegionReplicaSet(null);
}

private static void clearDataRegionReplicaSet(final InsertRowsNode insertRowsNode) {
insertRowsNode.setDataRegionReplicaSet(null);
for (final InsertRowNode insertRowNode : insertRowsNode.getInsertRowNodeList()) {
clearDataRegionReplicaSet(insertRowNode);
}
}

private static void clearDataRegionReplicaSet(final InsertTabletNode insertTabletNode) {
insertTabletNode.setDataRegionReplicaSet(null);
}

@jt2594838 jt2594838 Jul 23, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

image

May add planNodeTree.clearUselessFieldAfterDispatch here.

@jt2594838
jt2594838 merged commit 8c68dd7 into apache:master Jul 28, 2026
40 of 43 checks passed
@luoluoyuyu

Copy link
Copy Markdown
Member Author
img_v3_0213s_9950002f-f1a1-481e-a293-fb33ce0af89g This optimization pre-calculates the required PublicBAOS capacity before serialization and allocates it once, avoiding repeated Arrays.copyOf calls caused by dynamic buffer growth for large requests. The change does not alter the data format or processing logic for Insert or Pipe transfers. It reduces transient memory peaks and array-copying overhead caused by the simultaneous retention of old and new byte[] buffers during expansion. The optimization covers serialization for Insert write requests and Pipe Tablet/InsertNode requests sent to sinks, with greater benefits for large Tablets, multi-Tablet requests, and high-volume writes. Benchmark results show that young-generation GC frequency can be reduced by approximately 1.2x to 2x, indicating fewer short-lived array allocations during serialization. The final request payload still needs to be retained; this optimization targets the extra temporary memory introduced by buffer expansion, rather than the necessary memory footprint of the request data itself.

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.

2 participants