hadoop-common-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Todd Lipcon <t...@cloudera.com>
Subject Re: why does not BlockSender use BufferedInputStream?
Date Fri, 18 Dec 2009 03:25:53 GMT
The DataNode actually uses the sendfile call to do the block data transfers
(through FileChannel.transferTo). The FileInputStream is just used in order
to get to the FileChannel object.

-Todd

On Thu, Dec 17, 2009 at 6:40 PM, Martin Mituzas <xietao1981@hotmail.com>wrote:

>
>  I checked the DataNode code and found the variable blockIn in BlockSender
> (used to read data from disk) is object of class RandomAccessFile. Why not
> used BufferedInputStream for performance improvement?
>
>
> public synchronized InputStream getBlockInputStream(Block b, long
> seekOffset) throws IOException {
>
>    File blockFile = getBlockFile(b);
>    RandomAccessFile blockInFile = new RandomAccessFile(blockFile, "r");
>    if (seekOffset > 0) {
>      blockInFile.seek(seekOffset);
>    }
>    return new FileInputStream(blockInFile.getFD());
>  }
> --
> View this message in context:
> http://old.nabble.com/why-does-not-BlockSender-use-BufferedInputStream--tp26838319p26838319.html
> Sent from the Hadoop core-user mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message