luoluoyuyu commented on PR #18233: URL: https://github.com/apache/iotdb/pull/18233#issuecomment-5099269931
<img width="2720" height="1132" alt="img_v3_0213s_9950002f-f1a1-481e-a293-fb33ce0af89g" src="https://github.com/user-attachments/assets/ce2cef31-9210-41a7-b128-ca9011a4a796" /> 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. -- 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: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
