Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 7B921200C29 for ; Tue, 28 Feb 2017 21:18:00 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 7A289160B7E; Tue, 28 Feb 2017 20:18:00 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C4AD5160B7C for ; Tue, 28 Feb 2017 21:17:59 +0100 (CET) Received: (qmail 56752 invoked by uid 500); 28 Feb 2017 20:17:59 -0000 Mailing-List: contact commits-help@asterixdb.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@asterixdb.apache.org Delivered-To: mailing list commits@asterixdb.apache.org Received: (qmail 56743 invoked by uid 99); 28 Feb 2017 20:17:59 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 28 Feb 2017 20:17:59 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id E2B00DFCA1; Tue, 28 Feb 2017 20:17:58 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: imaxon@apache.org To: commits@asterixdb.apache.org Message-Id: <700ba5deea8e43978621ff425036e8e5@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: asterixdb git commit: Make Xmx small on 32bit JVM Date: Tue, 28 Feb 2017 20:17:58 +0000 (UTC) archived-at: Tue, 28 Feb 2017 20:18:00 -0000 Repository: asterixdb Updated Branches: refs/heads/master 3c764a421 -> 206381e6d Make Xmx small on 32bit JVM There can be issues with the default memory parameter settings if run on a 32Bit JVM, as the maximum RAM can be large due to PAE or using 32bit JVM on a 64bit OS, therefore leading to an -Xmx setting that is too large to address. This makes the maximum 1GB by default on 32bit JVMs, as there is a related issue on Windows where 32 bit processes are limited to about 1.5G per process. Change-Id: I025174fc2ca53e8d15ed53fac31b43bea3ddf281 Reviewed-on: https://asterix-gerrit.ics.uci.edu/1521 Sonar-Qube: Jenkins Tested-by: Jenkins Reviewed-by: Michael Blow Integration-Tests: Jenkins Project: http://git-wip-us.apache.org/repos/asf/asterixdb/repo Commit: http://git-wip-us.apache.org/repos/asf/asterixdb/commit/206381e6 Tree: http://git-wip-us.apache.org/repos/asf/asterixdb/tree/206381e6 Diff: http://git-wip-us.apache.org/repos/asf/asterixdb/diff/206381e6 Branch: refs/heads/master Commit: 206381e6d2aef1b5d85a0a96619a9ce57fe6f217 Parents: 3c764a4 Author: Ian Maxon Authored: Mon Feb 27 16:09:03 2017 -0800 Committer: Ian Maxon Committed: Tue Feb 28 12:08:14 2017 -0800 ---------------------------------------------------------------------- .../hyracks/control/nc/service/NCService.java | 25 +++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/asterixdb/blob/206381e6/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java ---------------------------------------------------------------------- diff --git a/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java b/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java index 5a03d3c..9b00cc2 100644 --- a/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java +++ b/hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java @@ -111,7 +111,7 @@ public class NCService { return cList; } - private static void configEnvironment(Map env) { + private static void configEnvironment(Map env) { String jvmargs = IniUtils.getString(ini, nodeSection, "jvm.args", null); if (jvmargs != null) { LOGGER.info("Using JAVA_OPTS from conf file (jvm.args)"); @@ -122,7 +122,11 @@ public class NCService { } else { LOGGER.info("Using default JAVA_OPTS"); long ramSize = ((com.sun.management.OperatingSystemMXBean) osMXBean).getTotalPhysicalMemorySize(); - jvmargs = "-Xmx" + (int) Math.ceil(0.6 * ramSize / (1024 * 1024)) + "m"; + int proportionalRamSize = (int) Math.ceil(0.6 * ramSize / (1024 * 1024)); + //if under 32bit JVM, use less than 1GB heap by default. otherwise use proportional ramsize. + int heapSize = "32".equals(System.getProperty("sun.arch.data.model")) + ? (proportionalRamSize <= 1024 ? proportionalRamSize : 1024) : proportionalRamSize; + jvmargs = "-Xmx" + heapSize + "m"; } } env.put("JAVA_OPTS", jvmargs); @@ -132,10 +136,11 @@ public class NCService { /** * Attempts to launch the "real" NCDriver, based on the configuration * information gathered so far. + * * @return true if the process was successfully launched and has now - * exited with a 0 (normal) exit code. false if some configuration error - * prevented the process from being launched or the process returned - * a non-0 (abnormal) exit code. + * exited with a 0 (normal) exit code. false if some configuration error + * prevented the process from being launched or the process returned + * a non-0 (abnormal) exit code. */ private static boolean launchNCProcess() { try { @@ -149,13 +154,11 @@ public class NCService { } // Logfile - if (! "-".equals(config.logdir)) { + if (!"-".equals(config.logdir)) { pb.redirectErrorStream(true); File log = new File(config.logdir); - if (! log.mkdirs()) { - if (! log.isDirectory()) { - throw new IOException(config.logdir + ": cannot create"); - } + if (!log.mkdirs() && !log.isDirectory()) { + throw new IOException(config.logdir + ": cannot create"); // If the directory IS there, all is well } File logfile = new File(config.logdir, "nc-" + ncId + ".log"); @@ -202,7 +205,7 @@ public class NCService { try { ObjectInputStream ois = new ObjectInputStream(is); String magic = ois.readUTF(); - if (! ServiceConstants.NC_SERVICE_MAGIC_COOKIE.equals(magic)) { + if (!ServiceConstants.NC_SERVICE_MAGIC_COOKIE.equals(magic)) { LOGGER.severe("Connection used incorrect magic cookie"); return false; }