add read ahead input stream

This commit is contained in:
Chris Lu
2020-08-03 09:06:09 -07:00
parent 53190a9972
commit b3089dcc8e
3 changed files with 408 additions and 2 deletions

View File

@@ -11,6 +11,7 @@ import org.apache.hadoop.util.Progressable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import seaweedfs.client.FilerProto;
import seaweedfs.client.ReadAheadInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
@@ -76,7 +77,7 @@ public class SeaweedFileSystem extends FileSystem {
try {
FSInputStream inputStream = seaweedFileSystemStore.openFileForRead(path, statistics, bufferSize);
return new FSDataInputStream(new BufferedFSInputStream(inputStream, 16 * 1024 * 1024));
return new FSDataInputStream(new ReadAheadInputStream(inputStream, 16 * 1024 * 1024));
} catch (Exception ex) {
LOG.warn("open path: {} bufferSize:{}", path, bufferSize, ex);
return null;