[Improvement][Server] Optimize log display (#5311)
This commit is contained in:
parent
e92e29ef9a
commit
83519bdfc3
|
|
@ -482,18 +482,18 @@ public class OSUtils {
|
|||
/**
|
||||
* check memory and cpu usage
|
||||
*
|
||||
* @param systemCpuLoad systemCpuLoad
|
||||
* @param systemReservedMemory systemReservedMemory
|
||||
* @param maxCpuloadAvg maxCpuloadAvg
|
||||
* @param reservedMemory reservedMemory
|
||||
* @return check memory and cpu usage
|
||||
*/
|
||||
public static Boolean checkResource(double systemCpuLoad, double systemReservedMemory) {
|
||||
public static Boolean checkResource(double maxCpuloadAvg, double reservedMemory) {
|
||||
// system load average
|
||||
double loadAverage = loadAverage();
|
||||
// system available physical memory
|
||||
double availablePhysicalMemorySize = availablePhysicalMemorySize();
|
||||
|
||||
if (loadAverage > systemCpuLoad || availablePhysicalMemorySize < systemReservedMemory) {
|
||||
logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}", availablePhysicalMemorySize, loadAverage);
|
||||
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",
|
||||
loadAverage, availablePhysicalMemorySize, maxCpuloadAvg, reservedMemory);
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ public class TaskPriorityQueueConsumer extends Thread {
|
|||
result = dispatcher.dispatch(executionContext);
|
||||
}
|
||||
} catch (ExecuteException e) {
|
||||
logger.error("dispatch error", e);
|
||||
logger.error("dispatch error: {}", e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -26,12 +26,13 @@ import org.apache.dolphinscheduler.server.master.dispatch.exceptions.ExecuteExce
|
|||
import org.apache.dolphinscheduler.server.master.dispatch.executor.ExecutorManager;
|
||||
import org.apache.dolphinscheduler.server.master.dispatch.executor.NettyExecutorManager;
|
||||
import org.apache.dolphinscheduler.server.master.dispatch.host.HostManager;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* executor dispatcher
|
||||
*/
|
||||
|
|
@ -84,8 +85,8 @@ public class ExecutorDispatcher implements InitializingBean {
|
|||
|
||||
Host host = hostManager.select(context);
|
||||
if (StringUtils.isEmpty(host.getAddress())) {
|
||||
throw new ExecuteException(String.format("fail to execute : %s due to no suitable worker , " +
|
||||
"current task need to %s worker group execute",
|
||||
throw new ExecuteException(String.format("fail to execute : %s due to no suitable worker, "
|
||||
+ "current task needs worker group %s to execute",
|
||||
context.getCommand(),context.getWorkerGroup()));
|
||||
}
|
||||
context.setHost(host);
|
||||
|
|
|
|||
|
|
@ -158,8 +158,8 @@ public class LowerWeightHostManager extends CommonHostManager {
|
|||
String[] parts = heartbeat.split(Constants.COMMA);
|
||||
int status = Integer.parseInt(parts[8]);
|
||||
if (status == Constants.ABNORMAL_NODE_STATUS) {
|
||||
logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}",
|
||||
Double.parseDouble(parts[3]), Double.parseDouble(parts[2]));
|
||||
logger.warn("worker {} current cpu load average {} is too high or available memory {}G is too low",
|
||||
addr, Double.parseDouble(parts[2]), Double.parseDouble(parts[3]));
|
||||
return null;
|
||||
}
|
||||
double cpu = Double.parseDouble(parts[0]);
|
||||
|
|
|
|||
|
|
@ -89,14 +89,12 @@ public class HeartBeatTask implements Runnable {
|
|||
}
|
||||
}
|
||||
|
||||
double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize();
|
||||
double loadAverage = OSUtils.loadAverage();
|
||||
|
||||
double availablePhysicalMemorySize = OSUtils.availablePhysicalMemorySize();
|
||||
int status = Constants.NORMAL_NODE_STATUS;
|
||||
|
||||
if (availablePhysicalMemorySize < reservedMemory
|
||||
|| loadAverage > maxCpuloadAvg) {
|
||||
logger.warn("load is too high or availablePhysicalMemorySize(G) is too low, it's availablePhysicalMemorySize(G):{},loadAvg:{}", availablePhysicalMemorySize, loadAverage);
|
||||
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",
|
||||
loadAverage, availablePhysicalMemorySize, maxCpuloadAvg, reservedMemory);
|
||||
status = Constants.ABNORMAL_NODE_STATUS;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue