[
https://issues.apache.org/jira/browse/HADOOP-3164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12586530#action_12586530
]
Raghu Angadi commented on HADOOP-3164:
--------------------------------------
On windows, transferTo() returns 0 as expected. This is what I am planning to
do.
# Linux & Windows : will use {{out.getChannel()}} as the output channel for
transferTo() (which implies Java runtime does best it can). On Linux this
transfer happens in kernel and saves a little more than 75% cpu. I don't know
about Windows, it can't be worse 50% (see below).
# Rest of the platforms: will use {{out}} for transferTo(), which implies data
transfer happens through an internal direct buffer. This should give about 50%
cpu savings. Once we or some users confirm behavior of transferTo() with
non-blocking sockets, we could use {{out.getChannel()}} for those platforms.
Here, {{out}} is a {{o.a.h.ipc.SocketOutputStream}}.
I think using the real socket channel for Linux is worth the CPU savings.
> Use FileChannel.transferTo() when data is read from DataNode.
> -------------------------------------------------------------
>
> Key: HADOOP-3164
> URL: https://issues.apache.org/jira/browse/HADOOP-3164
> Project: Hadoop Core
> Issue Type: Improvement
> Components: dfs
> Reporter: Raghu Angadi
> Assignee: Raghu Angadi
> Attachments: HADOOP-3164.patch, HADOOP-3614.patch
>
>
> HADOOP-2312 talks about using FileChannel's
> [{{transferTo()}}|http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html#transferTo(long,%20long,%20java.nio.channels.WritableByteChannel)]
> and
> [{{transferFrom()}}|http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html#transferFrom(java.nio.channels.ReadableByteChannel,%20long,%20long)]
> in DataNode.
> At the time DataNode neither used NIO sockets nor wrote large chunks of
> contiguous block data to socket. Hadoop 0.17 does both when data is seved to
> clients (and other datanodes). I am planning to try using transferTo() in the
> trunk. This might reduce DataNode's cpu by another 50% or more.
> Once HADOOP-1702 is committed, we can look into using transferFrom().
--
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.