Ian Maxon has uploaded a new change for review.
https://asterix-gerrit.ics.uci.edu/1521
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
---
M asterixdb/asterix-client-helper/pom.xml
M
asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
M asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
M asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat
M
hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
M
hyracks-fullstack/hyracks/hyracks-control/hyracks-nc-service/src/main/java/org/apache/hyracks/control/nc/service/NCService.java
6 files changed, 33 insertions(+), 50 deletions(-)
git pull ssh://asterix-gerrit.ics.uci.edu:29418/asterixdb
refs/changes/21/1521/1
diff --git a/asterixdb/asterix-client-helper/pom.xml
b/asterixdb/asterix-client-helper/pom.xml
index 9a7bb64..726e8fa 100644
--- a/asterixdb/asterix-client-helper/pom.xml
+++ b/asterixdb/asterix-client-helper/pom.xml
@@ -41,26 +41,17 @@
<program>
<platforms>
<platform>unix</platform>
+ <platform>windows</platform>
</platforms>
<name>asterixhelper</name>
<mainClass>org.apache.asterix.clienthelper.AsterixHelper</mainClass>
</program>
</programs>
- <daemons>
- <daemon>
- <id>asterixhelper</id>
-
<mainClass>org.apache.asterix.clienthelper.AsterixHelper</mainClass>
- <platforms>
- <platform>booter-windows</platform>
- </platforms>
- </daemon>
- </daemons>
</configuration>
<executions>
<execution>
<goals>
<goal>assemble</goal>
- <goal>generate-daemons</goal>
</goals>
</execution>
</executions>
diff --git
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
index dd7c8e4..83ff3a2 100644
---
a/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
+++
b/asterixdb/asterix-common/src/main/java/org/apache/asterix/common/exceptions/ErrorCode.java
@@ -31,7 +31,7 @@
// 3000 ---- 3999: feed errors
// 4000 ---- 4999: lifecycle management errors
public class ErrorCode {
- private static final String RESOURCE_PATH = "asx_errormsg" +
File.separator + "en.properties";
+ private static final String RESOURCE_PATH = "asx_errormsg/en.properties";
public static final String ASTERIX = "ASX";
// Extension errors
diff --git
a/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
b/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
index 580e1e0..74ca87e 100644
--- a/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
+++ b/asterixdb/asterix-server/src/main/opt/local/bin/start-sample-cluster.bat
@@ -52,20 +52,6 @@
goto opts
:postopts
-if NOT DEFINED JAVA_HOME (
- echo ERROR: JAVA_HOME not defined
- goto :ERROR
-)
-REM ensure JAVA_HOME has no spaces nor quotes, since appassembler can't handle
them
-set JAVA_HOME=%JAVA_HOME:"=%
-for %%I in ("%JAVA_HOME%") do (
- set JAVA_HOME=%%~sI
-)
-
-set JAVACMD=%JAVA_HOME%\bin\java
-
-REM TODO(mblow): check java version, spaces in CWD
-
set DIRNAME=%~dp0
pushd %DIRNAME%\..
@@ -92,7 +78,7 @@
wmic process where ^
"name='java.exe' and CommandLine like
'%%org.codehaus.mojo.appassembler.booter.AppassemblerBooter%%' and (CommandLine
like '%%app.name=\"%%[cn]c\"%%' or CommandLine like
'%%app.name=\"%%ncservice\"%%')" ^
- GET processid > %tempfile% 2>/dev/null
+ GET processid > %tempfile% 2> nul
set severity=ERROR
if "%force%" == "1" set severity=WARNING
diff --git
a/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat
b/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat
index 7ac9483..6b02174 100644
--- a/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat
+++ b/asterixdb/asterix-server/src/main/opt/local/bin/stop-sample-cluster.bat
@@ -58,17 +58,6 @@
goto opts
:postopts
-if NOT DEFINED JAVA_HOME (
- echo ERROR: JAVA_HOME not defined
- goto :ERROR
-)
-
-REM ensure JAVA_HOME has no spaces nor quotes, since appassembler can't handle
them
-set JAVA_HOME=%JAVA_HOME:"=%
-for %%I in ("%JAVA_HOME%") do (
- set JAVA_HOME=%%~sI
-)
-
set DIRNAME=%~dp0
pushd %DIRNAME%\..
@@ -92,12 +81,12 @@
if "%tries%" == "60" goto :timed_out
wmic process where ^
"name='java.exe' and CommandLine like
'%%org.codehaus.mojo.appassembler.booter.AppassemblerBooter%%' and (CommandLine
like '%%app.name=\"%%[cn]c\"%%' or CommandLine like
'%%app.name=\"%%ncservice\"%%')" ^
- GET processid >%tempfile% 2>/dev/null
+ GET processid >%tempfile% 2> nul
set found=
for /F "skip=1" %%P in ('type %tempfile%') DO set found=1
if "%found%" == "1" (
- timeout /T 1 /NOBREAK >/dev/null
+ timeout /T 1 /NOBREAK > nul
goto :wait_loop
)
goto :post_shutdown
@@ -110,7 +99,7 @@
wmic process where ^
"name='java.exe' and CommandLine like
'%%org.codehaus.mojo.appassembler.booter.AppassemblerBooter%%' and (CommandLine
like '%%app.name=\"%%[cn]c\"%%' or CommandLine like
'%%app.name=\"%%ncservice\"%%')" ^
- GET processid > %tempfile% 2>/dev/null
+ GET processid > %tempfile% 2> nul
set found=
for /F "skip=1" %%P in ('type %tempfile%') DO set found=1
diff --git
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
index 3d99cdb..8d312d5 100644
---
a/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
+++
b/hyracks-fullstack/hyracks/hyracks-api/src/main/java/org/apache/hyracks/api/exceptions/ErrorCode.java
@@ -31,7 +31,7 @@
* 10000 ---- 19999: compilation errors
*/
public class ErrorCode {
- private static final String RESOURCE_PATH = "errormsg" + File.separator +
"en.properties";
+ private static final String RESOURCE_PATH = "errormsg/en.properties";
public static final String HYRACKS = "HYR";
// Runtime error codes.
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..88ba3f2 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,19 @@
return cList;
}
- private static void configEnvironment(Map<String,String> env) {
+ private static boolean is64Bit() {
+ String prop = System.getProperty("sun.arch.data.model");
+ if(prop == null || prop.equals("unknown")) {
+ //assert true if the property is null, this check mainly is to
avoid a specific default behavior
+ //where a 32 bit JVM is run on a 64 bit OS which has a lot of
available RAM
+ return true;
+ }
+ else{
+ return prop.equals("64");
+ }
+ }
+
+ 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 +134,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";
+ if (is64Bit()) {
+ jvmargs = "-Xmx" + (int) Math.ceil(0.6 * ramSize / (1024 *
1024)) + "m";
+ } else {
+ jvmargs = "-Xmx" + Math.min((int) Math.ceil(0.6 * ramSize
/ (1024 * 1024)), 1024) + "m";
+ }
}
}
env.put("JAVA_OPTS", jvmargs);
@@ -132,10 +148,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,11 +166,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()) {
+ if (!log.mkdirs()) {
+ if (!log.isDirectory()) {
throw new IOException(config.logdir + ": cannot
create");
}
// If the directory IS there, all is well
@@ -202,7 +219,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: newchange
Gerrit-Change-Id: I025174fc2ca53e8d15ed53fac31b43bea3ddf281
Gerrit-PatchSet: 1
Gerrit-Project: asterixdb
Gerrit-Branch: master
Gerrit-Owner: Ian Maxon <[email protected]>