This is an automated email from the ASF dual-hosted git repository. guangning pushed a commit to branch branch-2.5 in repository https://gitbox.apache.org/repos/asf/pulsar.git
commit c74b092e927b20d1b36975c6076e9bb341b45247 Author: roman-popenov <[email protected]> AuthorDate: Fri Feb 7 20:15:53 2020 -0500 [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. --- conf/bkenv.sh | 2 +- .../kubernetes/helm/pulsar/templates/bookkeeper-statefulset.yaml | 1 + deployment/kubernetes/helm/pulsar/values.yaml | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/conf/bkenv.sh b/conf/bkenv.sh index 6c82957..363d8d2 100644 --- a/conf/bkenv.sh +++ b/conf/bkenv.sh @@ -33,7 +33,7 @@ BOOKIE_CONF=${BOOKIE_CONF:-"$BK_HOME/conf/bookkeeper.conf"} # BOOKIE_LOG_DIR= # Memory size options -BOOKIE_MEM=${BOOKIE_MEM:-"-Xms2g -Xmx2g -XX:MaxDirectMemorySize=2g"} +BOOKIE_MEM=${BOOKIE_MEM:-${PULSAR_MEM:-"-Xms2g -Xmx2g -XX:MaxDirectMemorySize=2g"}} # Garbage collection options BOOKIE_GC=${BOOKIE_GC:-"-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"} diff --git a/deployment/kubernetes/helm/pulsar/templates/bookkeeper-statefulset.yaml b/deployment/kubernetes/helm/pulsar/templates/bookkeeper-statefulset.yaml index eb2597d..012eb4e 100644 --- a/deployment/kubernetes/helm/pulsar/templates/bookkeeper-statefulset.yaml +++ b/deployment/kubernetes/helm/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/deployment/kubernetes/helm/pulsar/values.yaml b/deployment/kubernetes/helm/pulsar/values.yaml index 90811b3..3132e65 100644 --- a/deployment/kubernetes/helm/pulsar/values.yaml +++ b/deployment/kubernetes/helm/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:+P [...] + 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:+Pri [...] + BOOKIE_GC: "\"-XX:+UseG1GC -XX:MaxGCPauseMillis=10\"" PULSAR_PREFIX_dbStorage_writeCacheMaxSizeMb: "2048" PULSAR_PREFIX_dbStorage_readAheadCacheMaxSizeMb: "2048" PULSAR_PREFIX_dbStorage_rocksDB_blockCacheSize: "268435456"
