Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class PhysicalIOConfiguration {
private static final boolean DEFAULT_SMALL_OBJECTS_PREFETCHING_ENABLED = true;
private static final long DEFAULT_SMALL_OBJECT_SIZE_THRESHOLD = 8 * ONE_MB;
private static final int DEFAULT_THREAD_POOL_SIZE = 96;
private static final long DEFAULT_READ_BUFFER_SIZE = 8 * ONE_KB;
private static final long DEFAULT_READ_BUFFER_SIZE = 128 * ONE_KB;
private static final long DEFAULT_TARGET_REQUEST_SIZE = 8 * ONE_MB;
private static final double DEFAULT_REQUEST_TOLERANCE_RATIO = 1.4;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void testToString() {
+ "\tsmallObjectsPrefetchingEnabled: true\n"
+ "\tsmallObjectSizeThreshold: 8388608\n"
+ "\tthreadPoolSize: 96\n"
+ "\treadBufferSize: 8192\n"
+ "\treadBufferSize: 131072\n"
+ "\ttargetRequestSize: 20\n"
+ "\trequestToleranceRatio: 1.4\n");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,7 @@ void testGetBlockIsEmptyWhenNotSmallObject() {
PhysicalIOConfiguration.builder()
.smallObjectSizeThreshold(8 * ONE_MB)
.smallObjectsPrefetchingEnabled(true)
.readBufferSize(8 * ONE_KB)
.build();

// Given
Expand All @@ -249,6 +250,7 @@ void testGetBlockIsNotEmptyWhenSmallObject() {
PhysicalIOConfiguration.builder()
.smallObjectSizeThreshold(8 * ONE_MB)
.smallObjectsPrefetchingEnabled(true)
.readBufferSize(8 * ONE_KB)
.build();
BlockManager blockManager = getTestBlockManager(objectClient, 42, configuration);

Expand All @@ -269,6 +271,7 @@ void testSmallObjectPrefetchingDisabled() {
.smallObjectsPrefetchingEnabled(false)
.smallObjectSizeThreshold(
8 * ONE_MB) // Make sure that threshold is always higher than small object size
.readBufferSize(8 * ONE_KB)
.build();

ObjectClient objectClient = mock(ObjectClient.class);
Expand Down Expand Up @@ -305,7 +308,10 @@ void testSmallObjectPrefetching() {
void testGetBlockReturnsAvailableBlock() {
// Given
PhysicalIOConfiguration config =
PhysicalIOConfiguration.builder().smallObjectsPrefetchingEnabled(false).build();
PhysicalIOConfiguration.builder()
.smallObjectsPrefetchingEnabled(false)
.readBufferSize(8 * ONE_KB)
.build();
BlockManager blockManager = getTestBlockManager(mock(ObjectClient.class), 65 * ONE_KB, config);

// When: have a 64KB block available from 0
Expand All @@ -320,7 +326,10 @@ void testMakePositionAvailableRespectsReadAhead() {
// Given

PhysicalIOConfiguration config =
PhysicalIOConfiguration.builder().smallObjectsPrefetchingEnabled(false).build();
PhysicalIOConfiguration.builder()
.smallObjectsPrefetchingEnabled(false)
.readBufferSize(8 * ONE_KB)
.build();

final int objectSize = (int) config.getReadAheadBytes() + ONE_KB;
ObjectClient objectClient = mock(ObjectClient.class);
Expand Down Expand Up @@ -368,7 +377,10 @@ void testMakeRangeAvailableDoesNotOverreadWhenSmallObjectPrefetchingIsDisabled()
getTestBlockManager(
objectClient,
136 * ONE_KB,
PhysicalIOConfiguration.builder().smallObjectsPrefetchingEnabled(false).build());
PhysicalIOConfiguration.builder()
.smallObjectsPrefetchingEnabled(false)
.readBufferSize(8 * ONE_KB)
.build());
blockManager.makePositionAvailable(
0, ReadMode.SYNC); // This code will create blocks [0,1,2,3,4,5,6,7]
blockManager.makePositionAvailable(
Expand Down Expand Up @@ -448,7 +460,10 @@ void regressionTestSequentialPrefetchShouldNotShrinkRanges() {
getTestBlockManager(
objectClient,
128 * ONE_MB,
PhysicalIOConfiguration.builder().sequentialPrefetchBase(2.0).build());
PhysicalIOConfiguration.builder()
.readBufferSize(8 * ONE_KB)
.sequentialPrefetchBase(2.0)
.build());
blockManager.makeRangeAvailable(20_837_974, 8_323_072, ReadMode.SYNC);
blockManager.makeRangeAvailable(20_772_438, 65_536, ReadMode.SYNC);
blockManager.makeRangeAvailable(29_161_046, 4_194_305, ReadMode.SYNC);
Expand Down Expand Up @@ -517,7 +532,11 @@ void testSequentialReadPattern() {
ObjectContent.builder().stream(new ByteArrayInputStream(new byte[1024])).build()));

PhysicalIOConfiguration config =
PhysicalIOConfiguration.builder().readAheadBytes(512).sequentialPrefetchBase(2.0).build();
PhysicalIOConfiguration.builder()
.readAheadBytes(512)
.sequentialPrefetchBase(2.0)
.readBufferSize(8 * ONE_KB)
.build();

BlockManager blockManager = getTestBlockManager(objectClient, 1024, config);

Expand Down Expand Up @@ -711,7 +730,9 @@ private BlockManager getTestBlockManager(int size) {
}

private BlockManager getTestBlockManager(ObjectClient objectClient, int size) {
return getTestBlockManager(objectClient, size, PhysicalIOConfiguration.DEFAULT);
PhysicalIOConfiguration configuration =
PhysicalIOConfiguration.builder().readBufferSize(8 * ONE_KB).build();
return getTestBlockManager(objectClient, size, configuration);
}

private BlockManager getTestBlockManager(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import static org.junit.jupiter.api.Assertions.*;
import static org.mockito.Mockito.*;
import static software.amazon.s3.analyticsaccelerator.util.Constants.ONE_KB;

import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.IOException;
Expand Down Expand Up @@ -52,7 +53,7 @@ public class BlockStoreTest {
public void setUp() {
mockIndexCache = mock(BlobStoreIndexCache.class);
mockMetrics = mock(Metrics.class);
configuration = PhysicalIOConfiguration.DEFAULT;
configuration = PhysicalIOConfiguration.builder().readBufferSize(8 * ONE_KB).build();
blockStore = new BlockStore(mockIndexCache, mockMetrics, configuration);
}

Expand Down