You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by pe...@apache.org on 2020/11/13 02:26:39 UTC
[pulsar] branch master updated: Add pulsar gc log (#7498)
This is an automated email from the ASF dual-hosted git repository.
penghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pulsar.git
The following commit(s) were added to refs/heads/master by this push:
new 3797f6f Add pulsar gc log (#7498)
3797f6f is described below
commit 3797f6fcceb97954f372e68a6494a6adad68a171
Author: Shoothzj <sh...@gmail.com>
AuthorDate: Fri Nov 13 10:26:19 2020 +0800
Add pulsar gc log (#7498)
Fixes #7450
### Motivation
Gc log is a useful tool to help our positioning our jvm runing situation. It can use to solve gc param is not reasonable, memory leak. I think if pulsar need this too.
---
conf/pulsar_env.sh | 9 +++++++++
conf/pulsar_tools_env.sh | 2 +-
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/conf/pulsar_env.sh b/conf/pulsar_env.sh
index 649bf6e..bd6c662 100755
--- a/conf/pulsar_env.sh
+++ b/conf/pulsar_env.sh
@@ -47,6 +47,15 @@ PULSAR_MEM=${PULSAR_MEM:-"-Xms2g -Xmx2g -XX:MaxDirectMemorySize=4g"}
# Garbage collection options
PULSAR_GC=${PULSAR_GC:-"-XX:+UseG1GC -XX:MaxGCPauseMillis=10 -XX:+ParallelRefProcEnabled -XX:+UnlockExperimentalVMOptions -XX:+DoEscapeAnalysis -XX:ParallelGCThreads=32 -XX:ConcGCThreads=32 -XX:G1NewSizePercent=50 -XX:+DisableExplicitGC -XX:-ResizePLAB"}
+# Garbage collection log.
+IS_JAVA_8=`java -version 2>&1 |grep version|grep '"1\.8'`
+if [ ! $IS_JAVA_8 ]; then
+ PULSAR_GC_LOG=${PULSAR_GC_LOG:-"-Xloggc:logs/pulsar_gc_%p.log -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=10 -XX:GCLogFileSize=20M"}
+else
+# After jdk 9, gc log param should config like this. Ignoring version less than jdk 8
+ PULSAR_GC_LOG=${PULSAR_GC_LOG:-"-Xlog:gc:logs/pulsar_gc_%p.log:time,uptime:filecount=10,filesize=20M"}
+fi
+
# Extra options to be passed to the jvm
PULSAR_EXTRA_OPTS=${PULSAR_EXTRA_OPTS:-" -Dpulsar.allocator.exit_on_oom=true -Dio.netty.recycler.maxCapacity.default=1000 -Dio.netty.recycler.linkCapacity=1024"}
diff --git a/conf/pulsar_tools_env.sh b/conf/pulsar_tools_env.sh
index 1a701fe..83923e6 100755
--- a/conf/pulsar_tools_env.sh
+++ b/conf/pulsar_tools_env.sh
@@ -48,7 +48,7 @@ PULSAR_MEM="-Xmx128m -XX:MaxDirectMemorySize=128m"
PULSAR_GC=" -client "
# Extra options to be passed to the jvm
-PULSAR_EXTRA_OPTS="${PULSAR_EXTRA_OPTS} ${PULSAR_MEM} ${PULSAR_GC} -Dio.netty.leakDetectionLevel=disabled"
+PULSAR_EXTRA_OPTS="${PULSAR_EXTRA_OPTS} ${PULSAR_MEM} ${PULSAR_GC} ${PULSAR_GC_LOG} -Dio.netty.leakDetectionLevel=disabled"
# Add extra paths to the bookkeeper classpath
# PULSAR_EXTRA_CLASSPATH=