asterixdb-notifications mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ian Maxon (Code Review)" <do-not-re...@asterixdb.incubator.apache.org>
Subject Change in asterixdb[master]: Make Xmx small on 32bit JVM
Date Tue, 28 Feb 2017 20:08:35 GMT
Ian Maxon has submitted this change and it was merged.

Change subject: Make Xmx small on 32bit JVM
......................................................................


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 <jenkins@fulliautomatix.ics.uci.edu>
Tested-by: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Reviewed-by: Michael Blow <mblow@apache.org>
Integration-Tests: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
---
M hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java
1 file changed, 14 insertions(+), 11 deletions(-)

Approvals:
  Michael Blow: Looks good to me, approved
  Jenkins: Verified; No violations found; Verified

Objections:
  Jenkins: Violations found



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 @@
         return cList;
     }
 
-    private static void configEnvironment(Map<String,String> env) {
+    private static void configEnvironment(Map<String, String> 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 @@
             } 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 @@
     /**
      * 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 @@
             }
 
             // 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 @@
         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;
             }

-- 
To view, visit https://asterix-gerrit.ics.uci.edu/1521
To unsubscribe, visit https://asterix-gerrit.ics.uci.edu/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I025174fc2ca53e8d15ed53fac31b43bea3ddf281
Gerrit-PatchSet: 10
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Ian Maxon <imaxon@apache.org>
Gerrit-Reviewer: Ian Maxon <imaxon@apache.org>
Gerrit-Reviewer: Jenkins <jenkins@fulliautomatix.ics.uci.edu>
Gerrit-Reviewer: Michael Blow <mblow@apache.org>
Gerrit-Reviewer: Xikui Wang <xkkwww@gmail.com>
Gerrit-Reviewer: Yingyi Bu <buyingyi@gmail.com>

Mime
View raw message