[ https://issues.apache.org/jira/browse/BEAM-14534?focusedWorklogId=776448&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-776448 ]
ASF GitHub Bot logged work on BEAM-14534: ----------------------------------------- Author: ASF GitHub Bot Created on: 31/May/22 17:04 Start Date: 31/May/22 17:04 Worklog Time Spent: 10m Work Description: steveniemitz opened a new pull request, #17783: URL: https://github.com/apache/beam/pull/17783 This PR adds a new interface, `ShuffleCompressor`, which allows users to plug in compression for values just before they're written to shuffle. The interface is a little odd, we originally had exposed it as simply wrapping Input/Output streams. However, this interface is much more efficient: - In the compression path, the implementor can use the RandomAccessData as both a buffer pool (using scratch space at the end for example) and also compress the data "in place" if possible. Additionally, many compression algorithms can operate more efficiently on a fixed-sized buffer rather than having to deal with an unknown amount of input data. - In the decompression path, using ByteBuffer allows efficiently slicing the input and output buffers as well. Ideally I think this interface would use ByteString as well, but didn't want to expose the shaded protobuf library in the public API. Additionally this also changes most places in the shuffle IO path to use ByteString rather than byte[]. This allows efficiently "slicing" the buffer received from the shuffle reader, removing a significant number of byte[] copies. Internally we have an implementation of ShuffleCompressor that uses zstd, and we see a significant benefit from using it. For example, at level 3 (the default), a simple `read -> reshuffle -> do something` pipeline sees a 50% reduction in data shuffled for our representative test datasets. R: @lukecwik ------------------------ Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily: - [x] [**Choose reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and mention them in a comment (`R: @username`). - [x] Format the pull request title like `[BEAM-XXX] Fixes bug in ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA issue, if applicable. This will automatically link the pull request to the issue. - [ ] Update `CHANGES.md` with noteworthy changes. - [x] If this contribution is large, please file an Apache [Individual Contributor License Agreement](https://www.apache.org/licenses/icla.pdf). See the [Contributor Guide](https://beam.apache.org/contribute) for more tips on [how to make review process smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier). To check the build health, please visit [https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md](https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md) GitHub Actions Tests Status (on master branch) ------------------------------------------------------------------------------------------------ [](https://github.com/apache/beam/actions?query=workflow%3A%22Build+python+source+distribution+and+wheels%22+branch%3Amaster+event%3Aschedule) [](https://github.com/apache/beam/actions?query=workflow%3A%22Python+Tests%22+branch%3Amaster+event%3Aschedule) [](https://github.com/apache/beam/actions?query=workflow%3A%22Java+Tests%22+branch%3Amaster+event%3Aschedule) See [CI.md](https://github.com/apache/beam/blob/master/CI.md) for more information about GitHub Actions CI. Issue Time Tracking ------------------- Worklog Id: (was: 776448) Remaining Estimate: 0h Time Spent: 10m > Add an interface to allow users to compress values being written to shuffle > --------------------------------------------------------------------------- > > Key: BEAM-14534 > URL: https://issues.apache.org/jira/browse/BEAM-14534 > Project: Beam > Issue Type: Improvement > Components: runner-dataflow > Reporter: Steve Niemitz > Assignee: Steve Niemitz > Priority: P2 > Time Spent: 10m > Remaining Estimate: 0h > > Frequently values being shuffled are large and compressible, while users can > compress them on their own by using a coder that compresses the data, it > would be nice to be able to do so globally for all values. -- This message was sent by Atlassian Jira (v8.20.7#820007)