Github user liyezhang556520 commented on a diff in the pull request:
https://github.com/apache/spark/pull/12083#discussion_r58287444
--- Diff:
common/network-common/src/main/java/org/apache/spark/network/protocol/MessageWithHeader.java
---
@@ -44,6 +45,14 @@
private long totalBytesTransferred;
/**
+ * When the write buffer size is larger than this limit, I/O will be
done in chunks of this size.
+ * The size should not be too large as it will waste underlying memory
copy. e.g. If network
+ * avaliable buffer is smaller than this limit, the data cannot be sent
within one single write
+ * operation while it still will make memory copy with this size.
+ */
+ private static final int NIO_BUFFER_LIMIT = 512 * 1024;
--- End diff --
>On my machine, /proc/sys/net/core/wmem_default is around 200k, which (I
assume) means you'd be copying about half of the buffer with no need here.
@vanzin , on my machine, both `wmem_default` and `wmem_max` are also around
200K, but in my test, I can successfully write more than 512K for each
`WritableByteChannel.write()`, this size should be the same with return size of
`writeFromNativeBuffer` as in line
http://www.grepcode.com/file/repository.grepcode.com/java/root/jdk/openjdk/7u40-b43/sun/nio/ch/IOUtil.java#65.
I don't know why. Can you also make a test?
---
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]