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 <[email protected]>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. > >
