From 8391b974c53ecedb1e59fc593aacd16e96830a8f Mon Sep 17 00:00:00 2001 From: Henning Andersen <33268011+henningandersen@users.noreply.github.com> Date: Mon, 16 Dec 2019 21:59:54 +0100 Subject: [PATCH] Recovery buffer size 16B smaller (#50100) G1GC will use humongous allocations when an allocation exceeds half the chosen region size, which is minimum 1MB. By reducing the recovery buffer size by 16 bytes we ensure that the recovery buffer is never allocated as a humongous allocation. --- .../org/elasticsearch/indices/recovery/RecoverySettings.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySettings.java b/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySettings.java index 3db04dec1d6..469529bb09f 100644 --- a/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySettings.java +++ b/server/src/main/java/org/elasticsearch/indices/recovery/RecoverySettings.java @@ -81,7 +81,8 @@ public class RecoverySettings { INDICES_RECOVERY_INTERNAL_LONG_ACTION_TIMEOUT_SETTING::get, TimeValue.timeValueSeconds(0), Property.Dynamic, Property.NodeScope); - public static final ByteSizeValue DEFAULT_CHUNK_SIZE = new ByteSizeValue(512, ByteSizeUnit.KB); + // choose 512KB-16B to ensure that the resulting byte[] is not a humongous allocation in G1. + public static final ByteSizeValue DEFAULT_CHUNK_SIZE = new ByteSizeValue(512 * 1024 - 16, ByteSizeUnit.BYTES); private volatile ByteSizeValue maxBytesPerSec; private volatile int maxConcurrentFileChunks;