[opt](routine-load) optimize allocate task to be algorithm for load balance (#32021)
This commit is contained in:
committed by
yiguolei
parent
6871c964af
commit
22782fec92
@ -484,7 +484,7 @@ public class RoutineLoadManager implements Writable {
|
||||
try {
|
||||
Map<Long, Integer> beIdToConcurrentTasks = getBeCurrentTasksNumMap();
|
||||
|
||||
// 1. Find if the given BE id has available slots
|
||||
// 1. Find if the given BE id has more than half of available slots
|
||||
if (previousBeId != -1L && availableBeIds.contains(previousBeId)) {
|
||||
// get the previousBackend info
|
||||
Backend previousBackend = Env.getCurrentSystemInfo().getBackend(previousBeId);
|
||||
@ -499,7 +499,7 @@ public class RoutineLoadManager implements Writable {
|
||||
} else {
|
||||
idleTaskNum = beIdToMaxConcurrentTasks.get(previousBeId);
|
||||
}
|
||||
if (idleTaskNum > 0) {
|
||||
if (idleTaskNum > (Config.max_routine_load_task_num_per_be >> 1)) {
|
||||
return previousBeId;
|
||||
}
|
||||
}
|
||||
|
||||
@ -299,7 +299,8 @@ public class RoutineLoadTaskScheduler extends MasterDaemon {
|
||||
}
|
||||
|
||||
// try to allocate a task to BE which has idle slot.
|
||||
// 1. First is to check if the previous allocated BE is available. If yes, allocate task to previous BE.
|
||||
// 1. First is to check if the previous allocated BE has more than half of available slots.
|
||||
// If yes, allocate task to previous BE.
|
||||
// 2. If not, try to find a better one with most idle slots.
|
||||
// return true if allocate successfully. return false if failed.
|
||||
// throw exception if unrecoverable errors happen.
|
||||
|
||||
Reference in New Issue
Block a user