From 09b327daf764403b7800180cab79ae3e38815075 Mon Sep 17 00:00:00 2001 From: Dominic Zippilli <35895831+domZippilli@users.noreply.github.com> Date: Fri, 13 Dec 2019 10:30:15 -0800 Subject: [PATCH] feat: increase DEFAULT_CHUNK_SIZE to reduce transfer overhead (#87) --- .../src/main/java/com/google/cloud/BaseWriteChannel.java | 4 ++-- .../src/test/java/com/google/cloud/BaseWriteChannelTest.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/google-cloud-core/src/main/java/com/google/cloud/BaseWriteChannel.java b/google-cloud-core/src/main/java/com/google/cloud/BaseWriteChannel.java index 865af88959..e45a5aead1 100644 --- a/google-cloud-core/src/main/java/com/google/cloud/BaseWriteChannel.java +++ b/google-cloud-core/src/main/java/com/google/cloud/BaseWriteChannel.java @@ -36,8 +36,8 @@ public abstract class BaseWriteChannel< ServiceOptionsT extends ServiceOptions, EntityT extends Serializable> implements WriteChannel { - private static final int MIN_CHUNK_SIZE = 256 * 1024; - private static final int DEFAULT_CHUNK_SIZE = 8 * MIN_CHUNK_SIZE; + private static final int MIN_CHUNK_SIZE = 256 * 1024; // 256 KiB + private static final int DEFAULT_CHUNK_SIZE = 60 * MIN_CHUNK_SIZE; // 15MiB private final ServiceOptionsT options; private final EntityT entity; diff --git a/google-cloud-core/src/test/java/com/google/cloud/BaseWriteChannelTest.java b/google-cloud-core/src/test/java/com/google/cloud/BaseWriteChannelTest.java index b5e5273420..3f539e5f64 100644 --- a/google-cloud-core/src/test/java/com/google/cloud/BaseWriteChannelTest.java +++ b/google-cloud-core/src/test/java/com/google/cloud/BaseWriteChannelTest.java @@ -55,8 +55,8 @@ protected CustomServiceOptions( private static final Serializable ENTITY = 42L; private static final String UPLOAD_ID = "uploadId"; private static final byte[] CONTENT = {0xD, 0xE, 0xA, 0xD}; - private static final int MIN_CHUNK_SIZE = 256 * 1024; - private static final int DEFAULT_CHUNK_SIZE = 8 * MIN_CHUNK_SIZE; + private static final int MIN_CHUNK_SIZE = 256 * 1024; // 256 KiB + private static final int DEFAULT_CHUNK_SIZE = 60 * MIN_CHUNK_SIZE; // 15MiB private static final Random RANDOM = new Random(); private static BaseWriteChannel channel;