You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by uc...@apache.org on 2015/07/14 11:35:02 UTC

flink git commit: [FLINK-2343] [scripts] Make CMS the default GC for streaming setups

Repository: flink
Updated Branches:
  refs/heads/master 91675296e -> d368a9bc1


[FLINK-2343] [scripts] Make CMS the default GC for streaming setups

This closes #901


Project: http://git-wip-us.apache.org/repos/asf/flink/repo
Commit: http://git-wip-us.apache.org/repos/asf/flink/commit/d368a9bc
Tree: http://git-wip-us.apache.org/repos/asf/flink/tree/d368a9bc
Diff: http://git-wip-us.apache.org/repos/asf/flink/diff/d368a9bc

Branch: refs/heads/master
Commit: d368a9bc14b2f5ff139ebdcad09829d7e1b006e1
Parents: 9167529
Author: Stephan Ewen <se...@apache.org>
Authored: Fri Jul 10 16:37:28 2015 +0200
Committer: Ufuk Celebi <uc...@apache.org>
Committed: Tue Jul 14 11:34:21 2015 +0200

----------------------------------------------------------------------
 flink-dist/src/main/flink-bin/bin/taskmanager.sh | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/flink/blob/d368a9bc/flink-dist/src/main/flink-bin/bin/taskmanager.sh
----------------------------------------------------------------------
diff --git a/flink-dist/src/main/flink-bin/bin/taskmanager.sh b/flink-dist/src/main/flink-bin/bin/taskmanager.sh
index 1920bd6..2bc20d9 100755
--- a/flink-dist/src/main/flink-bin/bin/taskmanager.sh
+++ b/flink-dist/src/main/flink-bin/bin/taskmanager.sh
@@ -29,11 +29,27 @@ bin=`cd "$bin"; pwd`
 . "$bin"/config.sh
 
 if [[ $STARTSTOP == "start" ]]; then
+
     # Use batch mode as default
     if [ -z $STREAMINGMODE ]; then
         echo "Missing streaming mode (batch|streaming). Using 'batch'."
         STREAMINGMODE="batch"
     fi
+    
+    # if mode is streaming and no other JVM options are set, set the 'Concurrent Mark Sweep GC'
+    if [[ $STREAMINGMODE == "streaming" ]] && [ -z $FLINK_ENV_JAVA_OPTS ]; then
+    
+        JAVA_VERSION=$($JAVA_RUN -version 2>&1 | sed 's/.*version "\(.*\)\.\(.*\)\..*"/\1\2/; 1q')
+    
+        # set the GC to G1 in Java 8 and to CMS in Java 7
+        if [[ ${JAVA_VERSION} =~ ${IS_NUMBER} ]]; then
+            if [ "$JAVA_VERSION" -lt 18 ]; then
+                export JVM_ARGS="$JVM_ARGS -XX:+UseConcMarkSweepGC -XX:+CMSClassUnloadingEnabled"
+            else
+                export JVM_ARGS="$JVM_ARGS -XX:+UseG1GC"
+            fi
+        fi
+    fi
 
     if [[ ! ${FLINK_TM_HEAP} =~ ${IS_NUMBER} ]]; then
         echo "[ERROR] Configured TaskManager JVM heap size is not a number. Please set '$KEY_TASKM_HEAP_MB' in $FLINK_CONF_FILE."