Permalink
Browse files

HBASE-7091: Support custom GC options in hbase-env.sh

git-svn-id: https://svn.apache.org/repos/asf/hbase/trunk@1424640 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
1 parent aef796c commit 9adf7054dcd21b17d1c3f73c5741b5eead42a32e Jesse Yates committed Dec 20, 2012
Showing with 31 additions and 4 deletions.
  1. +15 −0 bin/hbase
  2. +16 −4 conf/hbase-env.sh
View
15 bin/hbase
@@ -256,6 +256,21 @@ fi
# restore ordinary behaviour
unset IFS
+#Set the right GC options based on the what we are running
+declare -a client_cmds=("shell" "hbck" "hlog" "hfile" "zkcli")
+for cmd in $client_cmds; do
+ if [[ $cmd == $COMMAND ]]; then
+ client=true
+ break
+ fi
+done
+
+if [[ $client ]]; then
+ HBASE_OPTS="$HBASE_OPTS $CLIENT_GC_OPTS"
+else
+ HBASE_OPTS="$HBASE_OPTS $SERVER_GC_OPTS"
+fi
+
# figure out which class to run
if [ "$COMMAND" = "shell" ] ; then
# eg export JRUBY_HOME=/usr/local/share/jruby
View
20 conf/hbase-env.sh
@@ -21,6 +21,10 @@
# Set environment variables here.
+# This script sets variables multiple times over the course of starting an hbase process,
+# so try to keep things idempotent unless you want to take an even deeper look
+# into the startup scripts (bin/hbase, etc.)
+
# The java implementation to use. Java 1.6 required.
# export JAVA_HOME=/usr/java/jdk1.6.0/
@@ -34,12 +38,20 @@
# Below are what we set by default. May only work with SUN JVM.
# For more on why as well as other possible settings,
# see http://wiki.apache.org/hadoop/PerformanceTuning
-export HBASE_OPTS="$HBASE_OPTS -XX:+UseConcMarkSweepGC"
+export HBASE_OPTS="-XX:+UseConcMarkSweepGC"
+
+# Uncomment below to enable java garbage collection logging for the server-side processes
+# this enables basic gc logging for the server processes to the .out file
+# export SERVER_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps $HBASE_GC_OPTS"
+
+# this enables gc logging using automatic GC log rolling. Only applies to jdk 1.6.0_34+ and 1.7.0_2+. Either use this set of options or the one above
+# export SERVER_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+UseGCLogFileRotation -XX:NumberOfGCLogFiles=1 -XX:GCLogFileSize=512M $HBASE_GC_OPTS"
-# Uncomment below to enable java garbage collection logging in the .out file.
-# export HBASE_OPTS="$HBASE_OPTS -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps $HBASE_GC_OPTS"
+# Uncomment below to enable java garbage collection logging for the client processes in the .out file.
+# export CLIENT_GC_OPTS="-verbose:gc -XX:+PrintGCDetails -XX:+PrintGCDateStamps $HBASE_GC_OPTS"
-# Uncomment below (along with above GC logging) to put GC information in its own logfile (will set HBASE_GC_OPTS)
+# Uncomment below (along with above GC logging) to put GC information in its own logfile (will set HBASE_GC_OPTS).
+# This applies to both the server and client GC options above
# export HBASE_USE_GC_LOGFILE=true

0 comments on commit 9adf705

Please sign in to comment.