This is an automated email from the ASF dual-hosted git repository.
elek pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hadoop-ozone.git
The following commit(s) were added to refs/heads/master by this push:
new 1ebadbe HDDS-3173. Provide better default JVM options
1ebadbe is described below
commit 1ebadbe635f8b7c721f698b866252b6a84dc40fc
Author: Elek Márton <[email protected]>
AuthorDate: Fri Apr 3 13:13:39 2020 +0200
HDDS-3173. Provide better default JVM options
Closes #710
---
.../dist/src/shell/hdds/hadoop-functions.sh | 15 ++++++++
hadoop-ozone/dist/src/shell/ozone/ozone | 2 +
hadoop-ozone/dist/src/test/shell/gc_opts.bats | 44 ++++++++++++++++++++++
3 files changed, 61 insertions(+)
diff --git a/hadoop-ozone/dist/src/shell/hdds/hadoop-functions.sh
b/hadoop-ozone/dist/src/shell/hdds/hadoop-functions.sh
index 484fe23..1a89874 100755
--- a/hadoop-ozone/dist/src/shell/hdds/hadoop-functions.sh
+++ b/hadoop-ozone/dist/src/shell/hdds/hadoop-functions.sh
@@ -1541,6 +1541,21 @@ function hadoop_translate_cygwin_path
fi
}
+## @description Adds default GC parameters
+## @description Only for server components and only if no other -XX parameters
+## @description are set
+## @audience private
+## @stability evolving
+## @replaceable yes
+function hadoop_add_default_gc_opts
+{
+ if [[ "${HADOOP_SUBCMD_SUPPORTDAEMONIZATION}" == true ]]; then
+ if [[ ! "$HADOOP_OPTS" =~ "-XX" ]] ; then
+ hadoop_error "No '-XX:...' jvm parameters are used. Adding safer GC
settings to the HADOOP_OPTS"
+ HADOOP_OPTS="${HADOOP_OPTS} -XX:ParallelGCThreads=8
-XX:+UseConcMarkSweepGC -XX:CMSInitiatingOccupancyFraction=70
-XX:+CMSParallelRemarkEnabled"
+ fi
+ fi
+}
## @description Adds the HADOOP_CLIENT_OPTS variable to
## @description HADOOP_OPTS if HADOOP_SUBCMD_SUPPORTDAEMONIZATION is false
## @audience public
diff --git a/hadoop-ozone/dist/src/shell/ozone/ozone
b/hadoop-ozone/dist/src/shell/ozone/ozone
index ba80e07..4ec68d0 100755
--- a/hadoop-ozone/dist/src/shell/ozone/ozone
+++ b/hadoop-ozone/dist/src/shell/ozone/ozone
@@ -305,6 +305,8 @@ IFS=$OIFS
hadoop_add_client_opts
+hadoop_add_default_gc_opts
+
if [[ ${HADOOP_WORKER_MODE} = true ]]; then
hadoop_common_worker_mode_execute "${HADOOP_HDFS_HOME}/bin/ozone"
"${HADOOP_USER_PARAMS[@]}"
exit $?
diff --git a/hadoop-ozone/dist/src/test/shell/gc_opts.bats
b/hadoop-ozone/dist/src/test/shell/gc_opts.bats
new file mode 100644
index 0000000..1400a40
--- /dev/null
+++ b/hadoop-ozone/dist/src/test/shell/gc_opts.bats
@@ -0,0 +1,44 @@
+#!/usr/bin/env bash
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements. See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License. You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+
+
+#
+# Can be executed with bats (https://github.com/bats-core/bats-core)
+# bats gc_opts.bats (FROM THE CURRENT DIRECTORY)
+#
+
+source ../../shell/hdds/hadoop-functions.sh
+@test "Setting Hadoop GC parameters: add GC params for server" {
+ export HADOOP_SUBCMD_SUPPORTDAEMONIZATION=true
+ export HADOOP_OPTS="Test"
+ hadoop_add_default_gc_opts
+ [[ "$HADOOP_OPTS" =~ "UseConcMarkSweepGC" ]]
+}
+
+@test "Setting Hadoop GC parameters: disabled for client" {
+ export HADOOP_SUBCMD_SUPPORTDAEMONIZATION=false
+ export HADOOP_OPTS="Test"
+ hadoop_add_default_gc_opts
+ [[ ! "$HADOOP_OPTS" =~ "UseConcMarkSweepGC" ]]
+}
+
+@test "Setting Hadoop GC parameters: disabled if GC params are customized" {
+ export HADOOP_SUBCMD_SUPPORTDAEMONIZATION=true
+ export HADOOP_OPTS="-XX:++UseG1GC -Xmx512"
+ hadoop_add_default_gc_opts
+ [[ ! "$HADOOP_OPTS" =~ "UseConcMarkSweepGC" ]]
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]