Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Batch optimized SparkRunner groupByKey #33322

Merged

Conversation

twosom
Copy link
Contributor

@twosom twosom commented Dec 8, 2024

Please add a meaningful description for your change here

fixes #20943

This PR improves the performance of GroupByKey transform in SparkRunner by replacing the current implementation that uses Spark's groupByKey with combineByKey.

The current implementation uses Spark's groupByKey which causes all the data to be shuffled across the network before grouping. This can lead to significant performance overhead and potential OOM issues with large datasets.

By switching to Spark's combineByKey, we can:

  • Perform partial combining at the map side before shuffling
  • Reduce the amount of data transferred across the network
  • Improve memory utilization and overall performance

Before optimized - 6.1GiB for shuffle

스크린샷 2024-12-08 오후 7 42 03

After optimized - 1487.7MiB for shuffle.

스크린샷 2024-12-08 오후 9 22 45

Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:

  • Mention the appropriate issue in your description (for example: addresses #123), if applicable. This will automatically add a link to the pull request in the issue. If you would like the issue to automatically close on merging the pull request, comment fixes #<ISSUE NUMBER> instead.
  • Update CHANGES.md with noteworthy changes.
  • If this contribution is large, please file an Apache Individual Contributor License Agreement.

See the Contributor Guide for more tips on how to make review process smoother.

To check the build health, please visit https://github.com/apache/beam/blob/master/.test-infra/BUILD_STATUS.md

GitHub Actions Tests Status (on master branch)

Build python source distribution and wheels
Python tests
Java tests
Go tests

See CI.md for more information about GitHub Actions CI or the workflows README to see a list of phrases to trigger workflows.

@github-actions github-actions bot added the build label Dec 8, 2024
Copy link
Contributor

github-actions bot commented Dec 8, 2024

Checks are failing. Will not request review until checks are succeeding. If you'd like to override that behavior, comment assign set of reviewers

@twosom
Copy link
Contributor Author

twosom commented Dec 8, 2024

assign set of reviewers

Copy link
Contributor

github-actions bot commented Dec 8, 2024

Assigning reviewers. If you would like to opt out of this review, comment assign to next reviewer:

R: @damccorm for label build.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

Copy link
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

Thanks - had a few questions, but overall it seems like an improvement

@twosom
Copy link
Contributor Author

twosom commented Dec 12, 2024

@damccorm
Thanks for your question! I've added the explanation as a comment on the PR.

Copy link
Contributor

@damccorm damccorm left a comment

Choose a reason for hiding this comment

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

This LGTM, I'm rerunning the failing test suite to see if we can get a green signal before merging though (failure was due to pulling Java licenses, so likely unrelated to this change)

@damccorm damccorm merged commit a6061fe into apache:master Dec 13, 2024
20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Batch optimized translation for Spark Runner
2 participants