Skip to content

Commit f381795

Browse files
committed
test: tune parameters for current testbench performance
1 parent 84ffb6d commit f381795

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

google-cloud-storage/src/test/java/com/google/cloud/storage/ITObjectReadSessionTest.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void bytes()
9999
@Test
100100
public void lotsOfBytes() throws Exception {
101101
ChecksummedTestContent testContent =
102-
ChecksummedTestContent.of(DataGenerator.base64Characters().genBytes(512 * _1MiB));
102+
ChecksummedTestContent.of(DataGenerator.base64Characters().genBytes(256 * _1MiB));
103103

104104
BlobInfo gen1 =
105105
storage.create(
@@ -113,16 +113,16 @@ public void lotsOfBytes() throws Exception {
113113
try (BlobReadSession blobReadSession =
114114
storage.blobReadSession(blobId).get(30, TimeUnit.SECONDS)) {
115115

116-
int numRangesToRead = 256;
116+
int numRangesToRead = 128;
117117
List<ApiFuture<byte[]>> futures =
118118
LongStream.range(0, numRangesToRead)
119-
.mapToObj(i -> RangeSpec.of(i * _2MiB, (long) _2MiB))
119+
.mapToObj(i -> RangeSpec.of(i * _2MiB, _2MiB))
120120
.map(r -> blobReadSession.readRange(r, RangeProjectionConfigs.asFutureBytes()))
121121
.collect(Collectors.toList());
122122

123123
ApiFuture<List<byte[]>> listApiFuture = ApiFutures.allAsList(futures);
124124

125-
List<byte[]> ranges = listApiFuture.get(5, TimeUnit.SECONDS);
125+
List<byte[]> ranges = listApiFuture.get(30, TimeUnit.SECONDS);
126126
Stopwatch stop = sw.stop();
127127
System.out.println(stop.elapsed(TimeUnit.MILLISECONDS));
128128
Hasher hasher = Hashing.crc32c().newHasher();
@@ -149,7 +149,7 @@ public void lotsOfBytes() throws Exception {
149149
@Test
150150
public void lotsChannel() throws Exception {
151151
ChecksummedTestContent testContent =
152-
ChecksummedTestContent.of(DataGenerator.base64Characters().genBytes(512 * _1MiB));
152+
ChecksummedTestContent.of(DataGenerator.base64Characters().genBytes(256 * _1MiB));
153153

154154
BlobInfo gen1 =
155155
storage.create(
@@ -188,7 +188,7 @@ public void lotsChannel() throws Exception {
188188
@Test
189189
public void readRangeAsByteString() throws Exception {
190190
ChecksummedTestContent testContent =
191-
ChecksummedTestContent.of(DataGenerator.base64Characters().genBytes(512 * _1MiB));
191+
ChecksummedTestContent.of(DataGenerator.base64Characters().genBytes(256 * _1MiB));
192192

193193
BlobInfo gen1 =
194194
storage.create(
@@ -200,9 +200,9 @@ public void readRangeAsByteString() throws Exception {
200200

201201
Stopwatch sw = Stopwatch.createStarted();
202202
try (BlobReadSession blobReadSession =
203-
storage.blobReadSession(blobId).get(2, TimeUnit.SECONDS)) {
203+
storage.blobReadSession(blobId).get(30, TimeUnit.SECONDS)) {
204204

205-
int numRangesToRead = 256;
205+
int numRangesToRead = 128;
206206
List<ApiFuture<DisposableByteString>> futures =
207207
LongStream.range(0, numRangesToRead)
208208
.mapToObj(i -> RangeSpec.of(i * _2MiB, _2MiB))
@@ -211,7 +211,7 @@ public void readRangeAsByteString() throws Exception {
211211

212212
ApiFuture<List<DisposableByteString>> listApiFuture = ApiFutures.allAsList(futures);
213213

214-
List<DisposableByteString> ranges = listApiFuture.get(5, TimeUnit.SECONDS);
214+
List<DisposableByteString> ranges = listApiFuture.get(30, TimeUnit.SECONDS);
215215
Stopwatch stop = sw.stop();
216216
System.out.println(stop.elapsed(TimeUnit.MILLISECONDS));
217217
Hasher hasher = Hashing.crc32c().newHasher();

0 commit comments

Comments
 (0)