[Bug][Worker] get worker status bug (#13992)

* get worker status bug

* modify configuration name
This commit is contained in:
Aaron Wang 2023-04-24 09:51:47 +08:00 committed by GitHub
parent 5c1edd2912
commit 731123cebc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 7 deletions

View File

@ -55,6 +55,6 @@ If either of these is lower than the configured item, then this worker will not
You can customise the configuration by changing the following properties in worker.properties
- worker.max.cpuload.avg=-1 (worker max cpuload avg, only higher than the system cpu load average, worker server can be dispatched tasks. default value -1: the number of cpu cores * 2)
- worker.reserved.memory=0.3 (worker reserved memory, only lower than system available memory, worker server can be dispatched tasks. default value 0.3, the unit is G)
- worker.max.cpu.load.avg=-1 (worker max cpu load avg, only higher than the system cpu load average, worker server can be dispatched tasks. default value -1: the number of cpu cores * 2)
- worker.reserved.memory=0.3 (worker reserved memory, only lower than system available memory, worker server can be dispatched tasks. default value 0.3, the unit is percentage)

View File

@ -55,6 +55,6 @@ egmaster.host.selector=random不区分大小写
你可以在 worker.properties 修改下面的属性来自定义配置
* worker.max.cpuload.avg=-1 (worker最大cpuload均值只有高于系统cpuload均值时worker服务才能被派发任务. 默认值为-1: cpu cores * 2)
* worker.reserved.memory=0.3 (worker预留内存只有低于系统可用内存时worker服务才能被派发任务单位为G)
* worker.max.cpu.load.avg=-1 (worker最大cpu load均值只有高于系统cpu load均值时worker服务才能被派发任务. 默认值为-1: cpu cores * 2)
* worker.reserved.memory=0.3 (worker预留内存只有低于系统可用内存时worker服务才能被派发任务单位为百分比)

View File

@ -94,10 +94,10 @@ public class WorkerHeartBeatTask extends BaseHeartBeatTask<WorkerHeartBeat> {
double reservedMemory,
int workerExecThreadCount,
int workerWaitingTaskCount) {
if (cpuUsagePercentage > maxCpuUsePercentage || memoryUsagePercentage < reservedMemory) {
if (cpuUsagePercentage > maxCpuUsePercentage || (1 - memoryUsagePercentage) < reservedMemory) {
log.warn(
"current cpu load average {} is higher than {} max.cpuload.avg or available memory {} is lower than {} reserved.memory={}",
cpuUsagePercentage, maxCpuUsePercentage, memoryUsagePercentage, reservedMemory);
"current cpu load average {} is higher than {} or available memory {} is lower than {}",
cpuUsagePercentage, maxCpuUsePercentage, 1 - memoryUsagePercentage, reservedMemory);
return Constants.ABNORMAL_NODE_STATUS;
} else if (workerWaitingTaskCount > workerExecThreadCount) {
log.warn("current waiting task count {} is large than worker thread count {}, worker is busy",