siknezevic commented on pull request #27246:
URL: https://github.com/apache/spark/pull/27246#issuecomment-646872842


   > > Spilling SpillReader with 16000 rows: Best Time(ms) Avg Time(ms) 
Stdev(ms) Rate(M/s) Per Row(ns) Relative
   > > UnsafeSorterSpillReader_ratio1 568 727 200 0.5 2219.4 1.0X
   > > UnsafeSorterSpillReader_ratio1024 122902 123262 509 0.0 480085.1 0.0X
   > 
   > Thanks for the benchmarking! Could you run the benchmark code on both the 
master with/without this patch? Then, please describe performance differences 
in the PR description.
   
   @maropu
   The below are results of the following micro-benchmarks:
   
   1) Case when read buffer size is parameterized:
   
   OpenJDK 64-Bit Server VM 1.8.0_252-8u252-b09-1~16.04-b09 on Linux 
4.4.0-178-generic
   Intel(R) Xeon(R) CPU E5-2687W v3 @ 3.10GHz
   Spilling  SpillReader with 16000 rows:   Best/Avg Time(ms)    Rate(M/s)   
Per Row(ns)   Relative
   
//------------------------------------------------------------------------------------------------
   UnsafeSorterSpillReader_bufferSize1024        1312 / 1448          0.2       
 5125.1       1.0X
   UnsafeSorterSpillReader_bufferSize1024*1024  124134 / 125262          0.0    
  484897.4       0.0X
   
   2) Case when read buffer size is hard-codded to 1024 (1KB)
   
   Intel(R) Xeon(R) CPU E5-2687W v3 @ 3.10GHz
   Spilling  SpillReader with 16000 rows:   Best/Avg Time(ms)    Rate(M/s)   
Per Row(ns)   Relative
   
//------------------------------------------------------------------------------------------------
   UnsafeSorterSpillReader_bufferSize1024         228 /  351          1.1       
  892.1       1.0X
   
   3) Case when read buffer size is hard-coded to  1024*1024 (1MB)
   
   OpenJDK 64-Bit Server VM 1.8.0_252-8u252-b09-1~16.04-b09 on Linux 
4.4.0-178-generic
   Intel(R) Xeon(R) CPU E5-2687W v3 @ 3.10GHz
   Spilling  SpillReader with 16000 rows:   Best/Avg Time(ms)    Rate(M/s)   
Per Row(ns)   Relative
   
//------------------------------------------------------------------------------------------------
   UnsafeSorterSpillReader_bufferSize1024*1024  122350 / 123832          0.0    
  477930.4       1.0X
   
   
   If you compare the micro-benchmark results of parameterized execution 1) 
with hard-coded results 2) of 1024 buffer size you can noticed performance hit 
(around 5X). Created micro-benchmark simulates 100000 joins (creates 100000 
iterators). You will notice just 2 sec performance hit for buffer 
1024*1024.This is understandable because 1MB buffer size already has big 
performance impact.
   
   With 10TB TPCDS data set I tested spilling with query q14a and buffer size 
of 1024. Execution with hard-coded read buffer size is faster by 37% (27 min vs 
37 min) comparing to the execution when buffer size is parameterized and the 
same size 1024 is used. Query q14a, for 10TB data set, generates around 180 
million joins per partition and when buffer size is parameterized, that 
translates into 10 min longer execution time. 
   
   Could you please let me know would it be OK to hard-code the read buffer 
size to 1024? 
   Taking in the consideration that UnsafeSorterSpillReader already has logic 
to adjust buffer size to actual data size when needed.
   Thank you very much for your help


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to