Skip to content

Commit 76d92eb

Browse files
HADOOP-17596. ABFS: Change default Readahead Queue Depth from num(processors) to const (apache#2795)
. Contributed by Sumangala Patki.
1 parent 2707f69 commit 76d92eb

File tree

3 files changed

+18
-2
lines changed

3 files changed

+18
-2
lines changed

hadoop-tools/hadoop-azure/src/main/java/org/apache/hadoop/fs/azurebfs/constants/FileSystemConfigurations.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ public final class FileSystemConfigurations {
8888
public static final int MIN_LEASE_DURATION = 15;
8989
public static final int MAX_LEASE_DURATION = 60;
9090

91-
public static final int DEFAULT_READ_AHEAD_QUEUE_DEPTH = -1;
91+
public static final int DEFAULT_READ_AHEAD_QUEUE_DEPTH = 2;
9292

9393
public static final boolean DEFAULT_ENABLE_FLUSH = true;
9494
public static final boolean DEFAULT_DISABLE_OUTPUTSTREAM_FLUSH = true;

hadoop-tools/hadoop-azure/src/site/markdown/abfs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -803,7 +803,7 @@ pattern is detected.
803803
`fs.azure.readaheadqueue.depth`: Sets the readahead queue depth in
804804
AbfsInputStream. In case the set value is negative the read ahead queue depth
805805
will be set as Runtime.getRuntime().availableProcessors(). By default the value
806-
will be -1. To disable readaheads, set this value to 0. If your workload is
806+
will be 2. To disable readaheads, set this value to 0. If your workload is
807807
doing only random reads (non-sequential) or you are seeing throttling, you
808808
may try setting this value to 0.
809809

hadoop-tools/hadoop-azure/src/test/java/org/apache/hadoop/fs/azurebfs/services/TestAbfsInputStream.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828

2929
import org.apache.hadoop.conf.Configuration;
3030
import org.apache.hadoop.fs.FileSystem;
31+
import org.apache.hadoop.fs.FSDataInputStream;
3132
import org.apache.hadoop.fs.FSDataOutputStream;
3233
import org.apache.hadoop.fs.FileStatus;
3334
import org.apache.hadoop.fs.Path;
@@ -48,6 +49,7 @@
4849

4950
import static org.apache.hadoop.test.LambdaTestUtils.intercept;
5051
import static org.apache.hadoop.fs.azurebfs.constants.AbfsHttpConstants.FORWARD_SLASH;
52+
import static org.apache.hadoop.fs.azurebfs.constants.ConfigurationKeys.FS_AZURE_READ_AHEAD_QUEUE_DEPTH;
5153

5254
/**
5355
* Unit test AbfsInputStream.
@@ -569,6 +571,20 @@ public void testDiffReadRequestSizeAndRAHBlockSize() throws Exception {
569571
testReadAheads(inputStream, FORTY_EIGHT_KB, SIXTEEN_KB);
570572
}
571573

574+
@Test
575+
public void testDefaultReadaheadQueueDepth() throws Exception {
576+
Configuration config = getRawConfiguration();
577+
config.unset(FS_AZURE_READ_AHEAD_QUEUE_DEPTH);
578+
AzureBlobFileSystem fs = getFileSystem(config);
579+
Path testFile = new Path("/testFile");
580+
fs.create(testFile);
581+
FSDataInputStream in = fs.open(testFile);
582+
Assertions.assertThat(
583+
((AbfsInputStream) in.getWrappedStream()).getReadAheadQueueDepth())
584+
.describedAs("readahead queue depth should be set to default value 2")
585+
.isEqualTo(2);
586+
}
587+
572588

573589
private void testReadAheads(AbfsInputStream inputStream,
574590
int readRequestSize,

0 commit comments

Comments
 (0)