未验证 提交 cb01b0de 编写于 作者: S Shiwen Cheng 提交者: GitHub

[1.3.7-prepare][Improvement] Impove text description, OSUtilsTest and reduce...

[1.3.7-prepare][Improvement] Impove text description, OSUtilsTest and reduce heap memory for create/upgrade-dolphinscheduler.sh (#5890)

* Rename NORAML_NODE_STATUS to NORMAL_NODE_STATUS

* Fix OSUtilsTest

* Optimize comments in properties

* Reduce heap size to 64m in create-dolphinscheduler.sh and upgrade-dolphinscheduler.sh

* [Improvement][License] Update oshi version in release-docs/LICENSE

* Add test prefix for test method
上级 b99eca5b
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<value-attributes> <value-attributes>
<type>int</type> <type>int</type>
</value-attributes> </value-attributes>
<description>master execute thread number to limit process instances</description> <description>master execute thread number to limit process instances in parallel</description>
<on-ambari-upgrade add="true"/> <on-ambari-upgrade add="true"/>
</property> </property>
<property> <property>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<value-attributes> <value-attributes>
<type>int</type> <type>int</type>
</value-attributes> </value-attributes>
<description>worker execute thread number to limit task instances</description> <description>worker execute thread number to limit task instances in parallel</description>
<on-ambari-upgrade add="true"/> <on-ambari-upgrade add="true"/>
</property> </property>
<property> <property>
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# master listen port # master listen port
#master.listen.port=5678 #master.listen.port=5678
# master execute thread number to limit process instances # master execute thread number to limit process instances in parallel
master.exec.threads=${MASTER_EXEC_THREADS} master.exec.threads=${MASTER_EXEC_THREADS}
# master execute task number in parallel per process instance # master execute task number in parallel per process instance
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# worker listener port # worker listener port
#worker.listen.port=1234 #worker.listen.port=1234
# worker execute thread number to limit task instances # worker execute thread number to limit task instances in parallel
worker.exec.threads=${WORKER_EXEC_THREADS} worker.exec.threads=${WORKER_EXEC_THREADS}
# worker heartbeat interval, the unit is second # worker heartbeat interval, the unit is second
......
...@@ -995,7 +995,7 @@ public final class Constants { ...@@ -995,7 +995,7 @@ public final class Constants {
*/ */
public static final String PLUGIN_JAR_SUFFIX = ".jar"; public static final String PLUGIN_JAR_SUFFIX = ".jar";
public static final int NORAML_NODE_STATUS = 0; public static final int NORMAL_NODE_STATUS = 0;
public static final int ABNORMAL_NODE_STATUS = 1; public static final int ABNORMAL_NODE_STATUS = 1;
public static final String START_TIME = "start time"; public static final String START_TIME = "start time";
......
...@@ -88,7 +88,7 @@ public class OSUtils { ...@@ -88,7 +88,7 @@ public class OSUtils {
*/ */
public static double availablePhysicalMemorySize() { public static double availablePhysicalMemorySize() {
GlobalMemory memory = hal.getMemory(); GlobalMemory memory = hal.getMemory();
double availablePhysicalMemorySize = memory.getAvailable() / 1024.0 / 1024 / 1024; double availablePhysicalMemorySize = memory.getAvailable() / 1024.0 / 1024 / 1024;
DecimalFormat df = new DecimalFormat(TWO_DECIMAL); DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP); df.setRoundingMode(RoundingMode.HALF_UP);
...@@ -101,9 +101,9 @@ public class OSUtils { ...@@ -101,9 +101,9 @@ public class OSUtils {
* Keep 2 decimal * Keep 2 decimal
* @return available Physical Memory Size, unit: G * @return available Physical Memory Size, unit: G
*/ */
public static double totalMemorySize() { public static double totalPhysicalMemorySize() {
GlobalMemory memory = hal.getMemory(); GlobalMemory memory = hal.getMemory();
double totalPhysicalMemorySize = memory.getTotal() / 1024.0 / 1024 / 1024; double totalPhysicalMemorySize = memory.getTotal() / 1024.0 / 1024 / 1024;
DecimalFormat df = new DecimalFormat(TWO_DECIMAL); DecimalFormat df = new DecimalFormat(TWO_DECIMAL);
df.setRoundingMode(RoundingMode.HALF_UP); df.setRoundingMode(RoundingMode.HALF_UP);
......
...@@ -39,7 +39,7 @@ login.user.keytab.path=/opt/hdfs.headless.keytab ...@@ -39,7 +39,7 @@ login.user.keytab.path=/opt/hdfs.headless.keytab
# kerberos expire time, the unit is hour # kerberos expire time, the unit is hour
kerberos.expire.time=2 kerberos.expire.time=2
# resource view suffixss # resource view suffixs
#resource.view.suffixs=txt,log,sh,bat,conf,cfg,py,java,sql,xml,hql,properties,json,yml,yaml,ini,js #resource.view.suffixs=txt,log,sh,bat,conf,cfg,py,java,sql,xml,hql,properties,json,yml,yaml,ini,js
# if resource.storage.type=HDFS, the user must have the permission to create directories under the HDFS root path # if resource.storage.type=HDFS, the user must have the permission to create directories under the HDFS root path
......
...@@ -19,15 +19,11 @@ package org.apache.dolphinscheduler.common.os; ...@@ -19,15 +19,11 @@ package org.apache.dolphinscheduler.common.os;
import org.apache.dolphinscheduler.common.utils.OSUtils; import org.apache.dolphinscheduler.common.utils.OSUtils;
import java.math.RoundingMode; import org.junit.Assert;
import java.text.DecimalFormat;
import org.junit.Test; import org.junit.Test;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import oshi.hardware.GlobalMemory;
/** /**
* OSUtilsTest * OSUtilsTest
*/ */
...@@ -36,40 +32,33 @@ public class OSUtilsTest { ...@@ -36,40 +32,33 @@ public class OSUtilsTest {
private static Logger logger = LoggerFactory.getLogger(OSUtilsTest.class); private static Logger logger = LoggerFactory.getLogger(OSUtilsTest.class);
@Test @Test
public void memoryUsage() { public void testMemoryUsage() {
logger.info("memoryUsage : {}", OSUtils.memoryUsage());// 0.3361799418926239 double memoryUsage = OSUtils.memoryUsage();
logger.info("memoryUsage : {}", memoryUsage);
Assert.assertTrue(memoryUsage >= 0.0);
} }
@Test @Test
public void availablePhysicalMemorySize() { public void testPhysicalMemorySize() {
logger.info("availablePhysicalMemorySize : {}", OSUtils.availablePhysicalMemorySize()); double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize();
logger.info("availablePhysicalMemorySize : {}", OSUtils.totalMemorySize() / 10); double totalPhysicalMemorySize = OSUtils.totalPhysicalMemorySize();
logger.info("availablePhysicalMemorySize : {}", availablePhysicalMemorySize);
logger.info("totalPhysicalMemorySize : {}", totalPhysicalMemorySize);
Assert.assertTrue(availablePhysicalMemorySize >= 0.0);
Assert.assertTrue(totalPhysicalMemorySize >= 0.0);
} }
@Test @Test
public void loadAverage() { public void testLoadAverage() {
logger.info("memoryUsage : {}", OSUtils.loadAverage()); double loadAverage = OSUtils.loadAverage();
} logger.info("loadAverage : {}", loadAverage);
Assert.assertTrue(loadAverage >= 0.0);
private void printMemory(GlobalMemory memory) {
logger.info("memoryUsage : {} %" , (memory.getTotal() - memory.getAvailable()) * 100 / memory.getTotal() );
} }
@Test @Test
public void cpuUsage() throws Exception { public void testCpuUsage() {
logger.info("cpuUsage : {}", OSUtils.cpuUsage());
Thread.sleep(1000L);
logger.info("cpuUsage : {}", OSUtils.cpuUsage());
double cpuUsage = OSUtils.cpuUsage(); double cpuUsage = OSUtils.cpuUsage();
logger.info("cpuUsage : {}", cpuUsage);
DecimalFormat df = new DecimalFormat("0.00"); Assert.assertTrue(cpuUsage >= 0.0);
df.setRoundingMode(RoundingMode.HALF_UP);
logger.info("cpuUsage1 : {}", df.format(cpuUsage));
} }
} }
...@@ -38,8 +38,8 @@ public class OSUtilsTest { ...@@ -38,8 +38,8 @@ public class OSUtilsTest {
public void testOSMetric(){ public void testOSMetric(){
double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize(); double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize();
Assert.assertTrue(availablePhysicalMemorySize > 0.0f); Assert.assertTrue(availablePhysicalMemorySize > 0.0f);
double totalMemorySize = OSUtils.totalMemorySize(); double totalPhysicalMemorySize = OSUtils.totalPhysicalMemorySize();
Assert.assertTrue(totalMemorySize > 0.0f); Assert.assertTrue(totalPhysicalMemorySize > 0.0f);
double loadAverage = OSUtils.loadAverage(); double loadAverage = OSUtils.loadAverage();
logger.info("loadAverage {}", loadAverage); logger.info("loadAverage {}", loadAverage);
double memoryUsage = OSUtils.memoryUsage(); double memoryUsage = OSUtils.memoryUsage();
......
...@@ -443,7 +443,7 @@ The text of each license is also included at licenses/LICENSE-[project].txt. ...@@ -443,7 +443,7 @@ The text of each license is also included at licenses/LICENSE-[project].txt.
core-3.1.1 https://mvnrepository.com/artifact/org.eclipse.jdt/core/3.1.1 Eclipse Public License v1.0 core-3.1.1 https://mvnrepository.com/artifact/org.eclipse.jdt/core/3.1.1 Eclipse Public License v1.0
logback-classic 1.2.3: https://mvnrepository.com/artifact/ch.qos.logback/logback-classic/1.2.3, EPL 1.0 and LGPL 2.1 logback-classic 1.2.3: https://mvnrepository.com/artifact/ch.qos.logback/logback-classic/1.2.3, EPL 1.0 and LGPL 2.1
logback-core 1.2.3: https://mvnrepository.com/artifact/ch.qos.logback/logback-core/1.2.3, EPL 1.0 and LGPL 2.1 logback-core 1.2.3: https://mvnrepository.com/artifact/ch.qos.logback/logback-core/1.2.3, EPL 1.0 and LGPL 2.1
oshi-core 3.5.0: https://mvnrepository.com/artifact/com.github.oshi/oshi-core/3.5.0, EPL 1.0 oshi-core 3.9.1: https://mvnrepository.com/artifact/com.github.oshi/oshi-core/3.9.1, EPL 1.0
junit 4.12: https://mvnrepository.com/artifact/junit/junit/4.12, EPL 1.0 junit 4.12: https://mvnrepository.com/artifact/junit/junit/4.12, EPL 1.0
h2-1.4.200 https://github.com/h2database/h2database/blob/master/LICENSE.txt, MPL 2.0 or EPL 1.0 h2-1.4.200 https://github.com/h2database/h2database/blob/master/LICENSE.txt, MPL 2.0 or EPL 1.0
......
...@@ -75,7 +75,7 @@ public class HeartBeatTask implements Runnable { ...@@ -75,7 +75,7 @@ public class HeartBeatTask implements Runnable {
double loadAverage = OSUtils.loadAverage(); double loadAverage = OSUtils.loadAverage();
double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize(); double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize();
int status = Constants.NORAML_NODE_STATUS; int status = Constants.NORMAL_NODE_STATUS;
if (loadAverage > maxCpuloadAvg || availablePhysicalMemorySize < reservedMemory) { if (loadAverage > maxCpuloadAvg || availablePhysicalMemorySize < reservedMemory) {
logger.warn("current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G", logger.warn("current cpu load average {} is too high or available memory {}G is too low, under max.cpuload.avg={} and reserved.memory={}G",
loadAverage, availablePhysicalMemorySize, maxCpuloadAvg, reservedMemory); loadAverage, availablePhysicalMemorySize, maxCpuloadAvg, reservedMemory);
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# master listen port # master listen port
#master.listen.port=5678 #master.listen.port=5678
# master execute thread number to limit process instances # master execute thread number to limit process instances in parallel
#master.exec.threads=100 #master.exec.threads=100
# master execute task number in parallel per process instance # master execute task number in parallel per process instance
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
# worker listener port # worker listener port
#worker.listen.port=1234 #worker.listen.port=1234
# worker execute thread number to limit task instances # worker execute thread number to limit task instances in parallel
#worker.exec.threads=100 #worker.exec.threads=100
# worker heartbeat interval, the unit is second # worker heartbeat interval, the unit is second
......
...@@ -26,7 +26,7 @@ export JAVA_HOME=$JAVA_HOME ...@@ -26,7 +26,7 @@ export JAVA_HOME=$JAVA_HOME
export DOLPHINSCHEDULER_CONF_DIR=$DOLPHINSCHEDULER_HOME/conf export DOLPHINSCHEDULER_CONF_DIR=$DOLPHINSCHEDULER_HOME/conf
export DOLPHINSCHEDULER_LIB_JARS=$DOLPHINSCHEDULER_HOME/lib/* export DOLPHINSCHEDULER_LIB_JARS=$DOLPHINSCHEDULER_HOME/lib/*
export DOLPHINSCHEDULER_OPTS="-server -Xmx1g -Xms1g -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" export DOLPHINSCHEDULER_OPTS="-server -Xms64m -Xmx64m -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=64m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70"
export STOP_TIMEOUT=5 export STOP_TIMEOUT=5
CLASS=org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler CLASS=org.apache.dolphinscheduler.dao.upgrade.shell.CreateDolphinScheduler
......
...@@ -26,7 +26,7 @@ export JAVA_HOME=$JAVA_HOME ...@@ -26,7 +26,7 @@ export JAVA_HOME=$JAVA_HOME
export DOLPHINSCHEDULER_CONF_DIR=$DOLPHINSCHEDULER_HOME/conf export DOLPHINSCHEDULER_CONF_DIR=$DOLPHINSCHEDULER_HOME/conf
export DOLPHINSCHEDULER_LIB_JARS=$DOLPHINSCHEDULER_HOME/lib/* export DOLPHINSCHEDULER_LIB_JARS=$DOLPHINSCHEDULER_HOME/lib/*
export DOLPHINSCHEDULER_OPTS="-server -Xmx1g -Xms1g -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=128m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70" export DOLPHINSCHEDULER_OPTS="-server -Xms64m -Xmx64m -Xss512k -XX:+DisableExplicitGC -XX:+UseConcMarkSweepGC -XX:+CMSParallelRemarkEnabled -XX:LargePageSizeInBytes=64m -XX:+UseFastAccessorMethods -XX:+UseCMSInitiatingOccupancyOnly -XX:CMSInitiatingOccupancyFraction=70"
export STOP_TIMEOUT=5 export STOP_TIMEOUT=5
CLASS=org.apache.dolphinscheduler.dao.upgrade.shell.UpgradeDolphinScheduler CLASS=org.apache.dolphinscheduler.dao.upgrade.shell.UpgradeDolphinScheduler
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册