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
Update grouping table to sample window size as well #24388
Conversation
The existing implementation only sampled the key/accumulator size but always measured the size of the window. Note the 50-75% improvement for non-globally windowed accumulation. There are also some trivial reductions hashCode/equality since we know that certain types are always non-null. Before Benchmark (distribution) (globallyWindowed) Mode Cnt Score Error Units PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniform true thrpt 15 12.775 ± 0.640 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniform false thrpt 15 6.047 ± 0.535 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine normal true thrpt 15 7.148 ± 0.473 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine normal false thrpt 15 4.233 ± 0.239 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine hotKey true thrpt 15 13.894 ± 0.649 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine hotKey false thrpt 15 6.708 ± 0.375 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniqueKeys true thrpt 15 2.286 ± 0.115 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniqueKeys false thrpt 15 1.765 ± 0.064 ops/s After Benchmark (distribution) (globallyWindowed) Mode Cnt Score Error Units PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniform true thrpt 15 13.399 ± 0.241 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniform false thrpt 15 11.522 ± 1.120 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine normal true thrpt 15 7.186 ± 0.123 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine normal false thrpt 15 6.578 ± 0.161 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine hotKey true thrpt 15 13.467 ± 0.562 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine hotKey false thrpt 15 9.704 ± 0.866 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniqueKeys true thrpt 15 2.264 ± 0.110 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniqueKeys false thrpt 15 2.255 ± 0.190 ops/s
Assigning reviewers. If you would like to opt out of this review, comment R: @robertwb for label java. Available commands:
The PR bot will only process comments in the main thread (not review comments). |
Run Java PreCommit |
R: @bhisevishal |
Stopping reviewer notifications for this pull request: review requested by someone other than the bot, ceding control |
@@ -189,16 +184,10 @@ <K> WindowedGroupingTableKey( | |||
K key, | |||
Collection<? extends BoundedWindow> windows, | |||
Coder<K> keyCoder, | |||
SizeEstimator<K> keySizer) { | |||
SizeEstimator sizer) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't this be a SizeEstimator? Or is there a reason size estimators are all untyped now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Caches::weigh doesn't care about type. It relies on Jamm which uses java's instrumentation API to measure the size of the object in memory.
Run Java PreCommit |
Run Java Precommit |
R: @damccorm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
The existing implementation only sampled the key/accumulator size but always measured the size of the window. Note the 50-75% improvement for non-globally windowed accumulation. There are also some trivial reductions hashCode/equality since we know that certain types are always non-null. Before Benchmark (distribution) (globallyWindowed) Mode Cnt Score Error Units PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniform true thrpt 15 12.775 ± 0.640 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniform false thrpt 15 6.047 ± 0.535 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine normal true thrpt 15 7.148 ± 0.473 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine normal false thrpt 15 4.233 ± 0.239 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine hotKey true thrpt 15 13.894 ± 0.649 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine hotKey false thrpt 15 6.708 ± 0.375 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniqueKeys true thrpt 15 2.286 ± 0.115 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniqueKeys false thrpt 15 1.765 ± 0.064 ops/s After Benchmark (distribution) (globallyWindowed) Mode Cnt Score Error Units PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniform true thrpt 15 13.399 ± 0.241 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniform false thrpt 15 11.522 ± 1.120 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine normal true thrpt 15 7.186 ± 0.123 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine normal false thrpt 15 6.578 ± 0.161 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine hotKey true thrpt 15 13.467 ± 0.562 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine hotKey false thrpt 15 9.704 ± 0.866 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniqueKeys true thrpt 15 2.264 ± 0.110 ops/s PrecombineGroupingTableBenchmark.sumIntegerBinaryCombine uniqueKeys false thrpt 15 2.255 ± 0.190 ops/s
The existing implementation only sampled the key/accumulator size but always measured the size of the window. Note the 50-75% improvement for non-globally windowed accumulation.
There are also some trivial reductions hashCode/equality since we know that certain types are always non-null.
Before
After
Thank you for your contribution! Follow this checklist to help us incorporate your contribution quickly and easily:
R: @username
).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, commentfixes #<ISSUE NUMBER>
instead.CHANGES.md
with noteworthy changes.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)
See CI.md for more information about GitHub Actions CI.