From 23179c06a351c9eac764ba826b50b0b95a3ce873 Mon Sep 17 00:00:00 2001 From: Billie Rinaldi Date: Thu, 12 Apr 2018 11:35:14 -0700 Subject: [PATCH] YARN-7936. Add default service AM Xmx. Contributed by Jian He (cherry picked from commit 53b3e594732e7a567dda4e08b9a8af5f87a4472a) --- .../apache/hadoop/yarn/service/client/ServiceClient.java | 9 +++++++-- .../apache/hadoop/yarn/service/conf/YarnServiceConf.java | 2 ++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java index 5731e11a197..d7148007c6c 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/client/ServiceClient.java @@ -667,8 +667,13 @@ public class ServiceClient extends AppAdminClient implements SliderExitCodes, Path appRootDir, boolean hasSliderAMLog4j) throws BadConfigException { JavaCommandLineBuilder CLI = new JavaCommandLineBuilder(); CLI.forceIPv4().headless(); - CLI.setJVMOpts(YarnServiceConf.get(YarnServiceConf.JVM_OPTS, null, - app.getConfiguration(), conf)); + String jvmOpts = YarnServiceConf + .get(YarnServiceConf.JVM_OPTS, "", app.getConfiguration(), conf); + if (!jvmOpts.contains("-Xmx")) { + jvmOpts += DEFAULT_AM_JVM_XMX; + } + + CLI.setJVMOpts(jvmOpts); if (hasSliderAMLog4j) { CLI.sysprop(SYSPROP_LOG4J_CONFIGURATION, YARN_SERVICE_LOG4J_FILENAME); CLI.sysprop(SYSPROP_LOG_DIR, ApplicationConstants.LOG_DIR_EXPANSION_VAR); diff --git a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java index 21470d41a68..1506532239d 100644 --- a/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java +++ b/hadoop-yarn-project/hadoop-yarn/hadoop-yarn-applications/hadoop-yarn-services/hadoop-yarn-services-core/src/main/java/org/apache/hadoop/yarn/service/conf/YarnServiceConf.java @@ -36,6 +36,8 @@ public class YarnServiceConf { public static final String AM_RESOURCE_MEM = "yarn.service.am-resource.memory"; public static final long DEFAULT_KEY_AM_RESOURCE_MEM = 1024; + public static final String DEFAULT_AM_JVM_XMX = " -Xmx768m "; + public static final String YARN_QUEUE = "yarn.service.queue"; public static final String API_SERVER_ADDRESS = "yarn.service.api-server.address";