-
Notifications
You must be signed in to change notification settings - Fork 28.3k
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
[SPARK-26337][SQL][TEST] Add benchmark for LongToUnsafeRowMap #23284
Conversation
|
...src/test/scala/org/apache/spark/sql/execution/benchmark/HashedRelationMetricsBenchmark.scala
Show resolved
Hide resolved
Test build #99964 has finished for PR 23284 at commit
|
Test build #99974 has finished for PR 23284 at commit
|
can you update #23284 (comment) ? The revert PR is already merged, so we should revert the revert PR and run the benchmark again, and post the results in the comment. |
BTW I think this proves that, in Java if |
Test build #99973 has finished for PR 23284 at commit
|
Thank you for ping me, @viirya and @cloud-fan . |
Test build #99979 has finished for PR 23284 at commit
|
retest this please |
To be honest, I cannot understand why the original performance degradation occurred. I think that read/write of Here is an article that addresses the similar topic regarding cc @rednaxelafx |
There's no good reason why 64-bit reads/writes shouldn't be atomic on a 64-bit machine, and I assume everything we're testing on is 64-bit these days. It was an issue in the past, and yes as you note, the JLS seems to allow for it to be implementation-specific. No idea... |
Test build #99985 has finished for PR 23284 at commit
|
@@ -6,6 +6,6 @@ Java HotSpot(TM) 64-Bit Server VM 1.8.0_181-b13 on Mac OS X 10.13.6 | |||
Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz | |||
LongToUnsafeRowMap metrics: Best/Avg Time(ms) Rate(M/s) Per Row(ns) Relative | |||
------------------------------------------------------------------------------------------------ | |||
LongToUnsafeRowMap 1265 / 1336 0.4 2530.5 1.0X | |||
LongToUnsafeRowMap 234 / 315 2.1 467.3 1.0X |
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.
Yep. It's a clear reason to have this benchmark (723b27c)
map.optimize() | ||
|
||
val threads = (0 to 100).map { _ => | ||
val thread = new Thread { |
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.
So, is this the real difference from AggregateBenchmark.LongToUnsafeRowMap benchmark case?
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.
I think multi-thread is the key here.
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.
yea, here we focus on multi-thread reading the same LongToUnsafeRowMap
.
* Results will be written to "benchmarks/HashedRelationMetricsBenchmark-results.txt". | ||
* }}} | ||
*/ | ||
object HashedRelationMetricsBenchmark extends SqlBasedBenchmark { |
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.
to match the real case, shall we benchmark BytesToBytesMap
instead of LongToUnsafeRowMap
? The real case is, we have one LongToUnsafeRowMap
for each thread, but they share the same BytesToBytesMap
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.
UnsafeHashedRelation
uses BytesToBytesMap
. LongHashedRelation
uses LongToUnsafeRowMap
. The real case is we have one LongHashedRelation
for each thread and they share the same LongToUnsafeRowMap
.
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.
oh yes I got messed up :P
I've posted the benchmarks for original master before the revert PR in previous comment. I think that is what you asked? |
The future reviewers may not know the context, when they see |
If so, let me update the previous comment. |
@cloud-fan Is this ready to merge? |
thanks, merging to master! |
## What changes were proposed in this pull request? Regarding the performance issue of SPARK-26155, it reports the issue on TPC-DS. I think it is better to add a benchmark for `LongToUnsafeRowMap` which is the root cause of performance regression. It can be easier to show performance difference between different metric implementations in `LongToUnsafeRowMap`. ## How was this patch tested? Manually run added benchmark. Closes apache#23284 from viirya/SPARK-26337. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
## What changes were proposed in this pull request? Regarding the performance issue of SPARK-26155, it reports the issue on TPC-DS. I think it is better to add a benchmark for `LongToUnsafeRowMap` which is the root cause of performance regression. It can be easier to show performance difference between different metric implementations in `LongToUnsafeRowMap`. ## How was this patch tested? Manually run added benchmark. Closes apache#23284 from viirya/SPARK-26337. Authored-by: Liang-Chi Hsieh <viirya@gmail.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
What changes were proposed in this pull request?
Regarding the performance issue of SPARK-26155, it reports the issue on TPC-DS. I think it is better to add a benchmark for
LongToUnsafeRowMap
which is the root cause of performance regression.It can be easier to show performance difference between different metric implementations in
LongToUnsafeRowMap
.How was this patch tested?
Manually run added benchmark.