Repository: incubator-samza Updated Branches: refs/heads/master 9b7e451c8 -> cb40a5986
SAMZA-400; default to -server for am and samza container Project: http://git-wip-us.apache.org/repos/asf/incubator-samza/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-samza/commit/cb40a598 Tree: http://git-wip-us.apache.org/repos/asf/incubator-samza/tree/cb40a598 Diff: http://git-wip-us.apache.org/repos/asf/incubator-samza/diff/cb40a598 Branch: refs/heads/master Commit: cb40a59860bfe0572f59e25a58562c35be6c0e73 Parents: 9b7e451 Author: Chris Riccomini <[email protected]> Authored: Mon Sep 15 13:17:56 2014 -0700 Committer: Chris Riccomini <[email protected]> Committed: Mon Sep 15 13:17:56 2014 -0700 ---------------------------------------------------------------------- samza-shell/src/main/bash/run-am.sh | 3 +++ samza-shell/src/main/bash/run-class.sh | 26 +++++++++++-------------- samza-shell/src/main/bash/run-container.sh | 3 +++ 3 files changed, 17 insertions(+), 15 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/cb40a598/samza-shell/src/main/bash/run-am.sh ---------------------------------------------------------------------- diff --git a/samza-shell/src/main/bash/run-am.sh b/samza-shell/src/main/bash/run-am.sh index c202596..3a6d40d 100755 --- a/samza-shell/src/main/bash/run-am.sh +++ b/samza-shell/src/main/bash/run-am.sh @@ -16,4 +16,7 @@ # specific language governing permissions and limitations # under the License. +# Check if server is set. If not - set server optimization +[[ $JAVA_OPTS != *-server* ]] && JAVA_OPTS="$JAVA_OPTS -server" + exec $(dirname $0)/run-class.sh org.apache.samza.job.yarn.SamzaAppMaster $@ http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/cb40a598/samza-shell/src/main/bash/run-class.sh ---------------------------------------------------------------------- diff --git a/samza-shell/src/main/bash/run-class.sh b/samza-shell/src/main/bash/run-class.sh index 1473965..2395b59 100755 --- a/samza-shell/src/main/bash/run-class.sh +++ b/samza-shell/src/main/bash/run-class.sh @@ -62,7 +62,7 @@ mkdir -p $base_dir/tmp JAVA_TEMP_DIR=$base_dir/tmp # Check whether the JVM supports GC Log rotation, and enable it if so. -function enable_gc_log_rotation { +function check_and_enable_gc_log_rotation { `$JAVA -Xloggc:/dev/null $GC_LOG_ROTATION_OPTS -version 2> /dev/null` if [ $? -eq 0 ] ; then JAVA_OPTS="$JAVA_OPTS $GC_LOG_ROTATION_OPTS" @@ -82,24 +82,20 @@ if [ -z "$SAMZA_LOG4J_CONFIG" ]; then export SAMZA_LOG4J_CONFIG=file:$base_dir/lib/log4j.xml fi -### Initialize JVM OPTS ### +### Inherit JVM_OPTS from task.opts configuration, and initialize defaults ### -# If JAVA_OPTS is not specified in job properties (task.opts), initialize to default -if [ -z "$JAVA_OPTS" ]; then - # Enable GC related flags - JAVA_OPTS="-Xmx768M -XX:+PrintGCDateStamps -Xloggc:$SAMZA_LOG_DIR/gc.log" +# Check if a max-heap size is specified. If not - set a 768M heap +[[ $JAVA_OPTS != *-Xmx* ]] && JAVA_OPTS="$JAVA_OPTS -Xmx768M" - # Enable GC log rotation by default - enable_gc_log_rotation -else - # Otherwise, check if the GC related flags are specified. If not - add the respective flags to JVM_OPTS. - [[ $JAVA_OPTS != *PrintGCDateStamps* && $JAVA_OPTS != *loggc* ]] && JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDateStamps -Xloggc:$SAMZA_LOG_DIR/gc.log" +# Check if the GC related flags are specified. If not - add the respective flags to JVM_OPTS. +[[ $JAVA_OPTS != *PrintGCDateStamps* && $JAVA_OPTS != *-Xloggc* ]] && JAVA_OPTS="$JAVA_OPTS -XX:+PrintGCDateStamps -Xloggc:$SAMZA_LOG_DIR/gc.log" - # Also check if GC log rotation is already enabled. If not - add the respective flags to JVM_OPTS - [[ $JAVA_OPTS != *UseGCLogFileRotation* ]] && enable_gc_log_rotation -fi +# Check if GC log rotation is already enabled. If not - add the respective flags to JVM_OPTS +[[ $JAVA_OPTS != *UseGCLogFileRotation* ]] && check_and_enable_gc_log_rotation + +# Check if 64 bit is set. If not - try and set it if it's supported +[[ $JAVA_OPTS != *-d64* ]] && check_and_enable_64_bit_mode -check_and_enable_64_bit_mode JAVA_OPTS="$JAVA_OPTS -Dlog4j.configuration=$SAMZA_LOG4J_CONFIG -Dsamza.log.dir=$SAMZA_LOG_DIR -Dsamza.container.name=$SAMZA_CONTAINER_NAME -Djava.io.tmpdir=$JAVA_TEMP_DIR" echo $JAVA $JAVA_OPTS -cp $CLASSPATH $@ http://git-wip-us.apache.org/repos/asf/incubator-samza/blob/cb40a598/samza-shell/src/main/bash/run-container.sh ---------------------------------------------------------------------- diff --git a/samza-shell/src/main/bash/run-container.sh b/samza-shell/src/main/bash/run-container.sh index 72cee18..af00eba 100755 --- a/samza-shell/src/main/bash/run-container.sh +++ b/samza-shell/src/main/bash/run-container.sh @@ -16,4 +16,7 @@ # specific language governing permissions and limitations # under the License. +# Check if server is set. If not - set server optimization +[[ $JAVA_OPTS != *-server* ]] && JAVA_OPTS="$JAVA_OPTS -server" + exec $(dirname $0)/run-class.sh org.apache.samza.container.SamzaContainer $@
