GitHub user JoshRosen opened a pull request:

    https://github.com/apache/spark/pull/18008

    [SPARK-20776] Fix perf. problems in TaskMetrics.nameToAccums map 
initialization

    ## What changes were proposed in this pull request?
    
    In 
    
    ```
    ./bin/spark-shell --master=local[64]
    ```
    
    I ran 
    
    ``` 
    sc.parallelize(1 to 100000, 100000).count()
    ```
    and profiled the time spend in the LiveListenerBus event processing thread. 
I discovered that the majority of the time was being spent initializing the 
`TaskMetrics.nameToAccums` map:
    
    
![image](https://cloud.githubusercontent.com/assets/50748/26131230/a9f83ee0-3a4d-11e7-9ac9-5b21e1c57083.png)
    
    By using a pre-sized Java hash map I was able to remove this performance 
bottleneck and prevent dropped listener events (the old code couldn't keep up 
with the event rate and dropped some events).
    
    ## How was this patch tested?
    
    Benchmarks described above.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/JoshRosen/spark nametoaccums-improvements

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/18008.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #18008
    
----
commit 622951f5f97ac79235070fad6b82a2de1e4fdfa0
Author: Josh Rosen <joshro...@databricks.com>
Date:   2016-06-10T23:26:50Z

    TaskMetrics nameToAccums improvements.

commit 4675b21b93e3f8912143ff0fe70268c22faa86bc
Author: Josh Rosen <joshro...@databricks.com>
Date:   2017-05-16T22:37:11Z

    Add comment.

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

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

Reply via email to