GitHub user liyezhang556520 opened a pull request:

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

    [SPARK-14290][CORE][backport-1.6] avoid significant memory copy in Netty's 
tran…

    ## What changes were proposed in this pull request?
    When netty transfer data that is not `FileRegion`, data will be in format 
of `ByteBuf`, If the data is large, there will occur significant performance 
issue because there is memory copy underlying in `sun.nio.ch.IOUtil.write`, the 
CPU is 100% used, and network is very low.
    
    In this PR, if data size is large, we will split it into small chunks to 
call `WritableByteChannel.write()`, so that avoid wasting of memory copy. 
Because the data can't be written within a single write, and it will call 
`transferTo` multiple times. 
    
    ## How was this patch tested?
    Spark unit test and manual test.
    Manual test:
    `sc.parallelize(Array(1,2,3),3).mapPartitions(a=>Array(new 
Array[Double](1024 * 1024 * 50)).iterator).reduce((a,b)=> a).length`
    
    For more details, please refer to 
[SPARK-14290](https://issues.apache.org/jira/browse/SPARK-14290)


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

    $ git pull https://github.com/liyezhang556520/spark 
apache-branch-1.6-spark-14290

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

    https://github.com/apache/spark/pull/12296.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 #12296
    
----
commit 9e37e7c4d1e495da91f68e912636dcf865691e39
Author: Zhang, Liye <[email protected]>
Date:   2016-04-11T08:05:44Z

    SPARK-14290/SPARK-13352 avoid significant memory copy in Netty's transferTo

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to