GitHub user liyezhang556520 opened a pull request:
https://github.com/apache/spark/pull/12083
[SPARK-14290][CORE][Network] avoid significant memory copy in netty's
transferTo
## 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 spark-14290
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/spark/pull/12083.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 #12083
----
commit 63ca85a5548858b4fe46a4ade062776cb6747cba
Author: Zhang, Liye <[email protected]>
Date: 2016-03-31T09:44:41Z
spark-14290 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]