wForget opened a new issue, #2786: URL: https://github.com/apache/uniffle/issues/2786
### Code of Conduct - [x] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) ### Search before asking - [x] I have searched in the [issues](https://github.com/apache/incubator-uniffle/issues?q=is%3Aissue) and found no similar issues. ### What would you like to be improved? `DecompressionWorker.get()` repeatedly scans previously processed batches and segments on every block read: ```java for (int i = 0; i < batchIndex; i++) { tasks.remove(i); } for (int i = 0; i < segmentIndex; i++) { blocks.remove(i); } ``` Most of these entries have already been removed. However, the loops still issue redundant `ConcurrentHashMap.remove()` calls. For a batch containing N blocks, sequential consumption performs `N(N−1)/2` redundant segment removals. A batch with 100,000 blocks therefore triggers approximately 5 billion redundant removals. Repeated scanning of historical batches adds further overhead as the reader processes more batches. This affects shuffle reads with overlapping decompression enabled. Spark executor threaddump samples may show: ```text java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1097) org.apache.uniffle.client.impl.DecompressionWorker.get(DecompressionWorker.java:174) org.apache.uniffle.client.impl.ShuffleReadClientImpl.readShuffleBlockData(ShuffleReadClientImpl.java:342) org.apache.spark.shuffle.reader.RssShuffleDataIterator.hasNext(RssShuffleDataIterator.java:145) org.apache.spark.util.CompletionIterator.hasNext(CompletionIterator.scala:31) org.apache.spark.shuffle.reader.RssShuffleReader$MultiPartitionIterator.hasNext(RssShuffleReader.java:428) ``` ### How should we improve? _No response_ ### Are you willing to submit PR? - [x] Yes I am willing to submit a PR! -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
