mirror of https://github.com/milvus-io/milvus.git
enhance: Enhance the load balancing of import tasks (#31423)
Optimize the load balancing of import tasks. issue: https://github.com/milvus-io/milvus/issues/31232 --------- Signed-off-by: bigsheeper <yihao.dai@zilliz.com>pull/31003/head
parent
d0dd962a2f
commit
c725f95885
|
@ -88,13 +88,20 @@ func (s *importScheduler) Close() {
|
|||
|
||||
func (s *importScheduler) process() {
|
||||
getNodeID := func(nodeSlots map[int64]int64) int64 {
|
||||
for nodeID, slots := range nodeSlots {
|
||||
if slots > 0 {
|
||||
nodeSlots[nodeID]--
|
||||
return nodeID
|
||||
var (
|
||||
nodeID int64 = NullNodeID
|
||||
maxSlots int64 = -1
|
||||
)
|
||||
for id, slots := range nodeSlots {
|
||||
if slots > 0 && slots > maxSlots {
|
||||
nodeID = id
|
||||
maxSlots = slots
|
||||
}
|
||||
}
|
||||
return NullNodeID
|
||||
if nodeID != NullNodeID {
|
||||
nodeSlots[nodeID]--
|
||||
}
|
||||
return nodeID
|
||||
}
|
||||
|
||||
jobs := s.imeta.GetJobBy()
|
||||
|
|
Loading…
Reference in New Issue