File tree Expand file tree Collapse file tree 3 files changed +18
-2
lines changed
hadoop-tools/hadoop-azure/src
main/java/org/apache/hadoop/fs/azurebfs/constants
test/java/org/apache/hadoop/fs/azurebfs/services Expand file tree Collapse file tree 3 files changed +18
-2
lines changed Original file line number Diff line number Diff 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 ;
Original file line number Diff line number Diff line change @@ -803,7 +803,7 @@ pattern is detected.
803803` fs.azure.readaheadqueue.depth ` : Sets the readahead queue depth in
804804AbfsInputStream. In case the set value is negative the read ahead queue depth
805805will 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
Original file line number Diff line number Diff line change 2828
2929import org .apache .hadoop .conf .Configuration ;
3030import org .apache .hadoop .fs .FileSystem ;
31+ import org .apache .hadoop .fs .FSDataInputStream ;
3132import org .apache .hadoop .fs .FSDataOutputStream ;
3233import org .apache .hadoop .fs .FileStatus ;
3334import org .apache .hadoop .fs .Path ;
4849
4950import static org .apache .hadoop .test .LambdaTestUtils .intercept ;
5051import 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 ,
You can’t perform that action at this time.
0 commit comments