From ef099c96d2feabfbfbe58d8a90175ed6497bf16f Mon Sep 17 00:00:00 2001 From: roman-popenov <58950486+roman-popenov@users.noreply.github.com> Date: Fri, 7 Feb 2020 20:15:53 -0500 Subject: [PATCH] [ISSUE-6131]: Ensure JVM memory and GC options are set for bookie (#6201) ### Motivation Fixes #6131 (caused by #5675): When upgrading an existing 2.4.1 bookie cluster to 2.5.0 on kubernetes, the bookie fails to start with the following exception during initialization: io.netty.util.internal.OutOfDirectMemoryError: failed to allocate 16777216 byte(s) of direct memory (used: 2147483648, max: 2147483648). This is caused by the fact that the bookie environment variables `BOOKIE_MEM` and `BOOKIE_FC` defined in conf/bkenv.sh has no effect, and it is always using the defaults values. #### Proposed solution: Set `BOOKIE_MEM` and `BOOKIE_GC` in the helm deployments charts and default to `PULSAR_MEM` if the `BOOKIE` settings are not set and then use the default settings if none of those environment variables are set. #### Changes made Helm chart deployment `values.yaml` and `values-mini.yaml` along with the `bkenv.sh` configuration script. ### Documentation Currently, the documentation explaining the deployment process and how to change settings is lacking and need to be updated. --- pulsar/templates/bookkeeper-statefulset.yaml | 1 + pulsar/values.yaml | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/pulsar/templates/bookkeeper-statefulset.yaml b/pulsar/templates/bookkeeper-statefulset.yaml index eb2597d..012eb4e 100644 --- a/pulsar/templates/bookkeeper-statefulset.yaml +++ b/pulsar/templates/bookkeeper-statefulset.yaml @@ -115,6 +115,7 @@ spec: - > bin/apply-config-from-env.py conf/bookkeeper.conf && bin/apply-config-from-env.py conf/pulsar_env.sh && + bin/apply-config-from-env.py conf/bkenv.sh && bin/pulsar bookie ports: - name: client diff --git a/pulsar/values.yaml b/pulsar/values.yaml index d4f7a63..ab9aef9 100644 --- a/pulsar/values.yaml +++ b/pulsar/values.yaml @@ -179,7 +179,8 @@ bookkeeper: ## templates/bookkeeper-configmap.yaml ## configData: - PULSAR_MEM: "\"-Xms15g -Xmx15g -XX:MaxDirectMemorySize=15g -Dio.netty.leakDetectionLevel=disabled -Dio.netty.recycler.linkCapacity=1024 -XX:+UseG1GC -XX:MaxGCPauseMillis=10 -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:+AggressiveOpts -XX:+DoEscapeAnalysis -XX:ParallelGCThreads=32 -XX:ConcGCThreads=32 -XX:G1NewSizePercent=50 -XX:+DisableExplicitGC -XX:-ResizePLAB -XX:+ExitOnOutOfMemoryError -XX:+PerfDisableSharedMem -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintHeapAtGC -verbosegc -XX:G1LogLevel=finest\"" + BOOKIE_MEM: "\"-Xms15g -Xmx15g -XX:MaxDirectMemorySize=15g -Dio.netty.leakDetectionLevel=disabled -Dio.netty.recycler.linkCapacity=1024 -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:+AggressiveOpts -XX:+DoEscapeAnalysis -XX:ParallelGCThreads=32 -XX:ConcGCThreads=32 -XX:G1NewSizePercent=50 -XX:+DisableExplicitGC -XX:-ResizePLAB -XX:+ExitOnOutOfMemoryError -XX:+PerfDisableSharedMem -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationStoppedTime -XX:+PrintHeapAtGC -verbosegc -XX:G1LogLevel=finest\"" + BOOKIE_GC: "\"-XX:+UseG1GC -XX:MaxGCPauseMillis=10\"" PULSAR_PREFIX_dbStorage_writeCacheMaxSizeMb: "2048" PULSAR_PREFIX_dbStorage_readAheadCacheMaxSizeMb: "2048" PULSAR_PREFIX_dbStorage_rocksDB_blockCacheSize: "268435456"