mirror of https://github.com/milvus-io/milvus.git
enhance: make balance cost threshold configurable (#30636)
Signed-off-by: sunby <sunbingyi1992@gmail.com>pull/30502/head
parent
3ee13d9b20
commit
564b12c661
|
@ -53,6 +53,7 @@ var (
|
|||
RoundRobinBalancerName = "RoundRobinBalancer"
|
||||
RowCountBasedBalancerName = "RowCountBasedBalancer"
|
||||
ScoreBasedBalancerName = "ScoreBasedBalancer"
|
||||
MultiTargetBalancerName = "MultipleTargetBalancer"
|
||||
)
|
||||
|
||||
type Balance interface {
|
||||
|
|
|
@ -97,7 +97,7 @@ func (m *segmentCountCostModel) cost() float64 {
|
|||
}
|
||||
|
||||
func cmpFloat(f1, f2 float64) int {
|
||||
if math.Abs(f1-f2) < 0.001 {
|
||||
if math.Abs(f1-f2) < params.Params.QueryCoordCfg.BalanceCostThreshold.GetAsFloat() {
|
||||
return 0
|
||||
}
|
||||
if f1 < f2 {
|
||||
|
|
|
@ -282,6 +282,8 @@ func (s *Server) initQueryCoord() error {
|
|||
s.nodeMgr, s.dist, s.meta, s.targetMgr)
|
||||
s.balancerMap[balance.ScoreBasedBalancerName] = balance.NewScoreBasedBalancer(s.taskScheduler,
|
||||
s.nodeMgr, s.dist, s.meta, s.targetMgr)
|
||||
s.balancerMap[balance.MultiTargetBalancerName] = balance.NewMultiTargetBalancer(s.taskScheduler, s.nodeMgr, s.dist, s.meta, s.targetMgr)
|
||||
|
||||
if balancer, ok := s.balancerMap[params.Params.QueryCoordCfg.Balancer.GetValue()]; ok {
|
||||
s.balancer = balancer
|
||||
log.Info("use config balancer", zap.String("balancer", params.Params.QueryCoordCfg.Balancer.GetValue()))
|
||||
|
|
|
@ -1369,6 +1369,7 @@ type queryCoordConfig struct {
|
|||
RowCountMaxSteps ParamItem `refreshable:"true"`
|
||||
RandomMaxSteps ParamItem `refreshable:"true"`
|
||||
GrowingRowCountWeight ParamItem `refreshable:"true"`
|
||||
BalanceCostThreshold ParamItem `refreshable:"true"`
|
||||
|
||||
SegmentCheckInterval ParamItem `refreshable:"true"`
|
||||
ChannelCheckInterval ParamItem `refreshable:"true"`
|
||||
|
@ -1596,6 +1597,16 @@ func (p *queryCoordConfig) init(base *BaseTable) {
|
|||
}
|
||||
p.GrowingRowCountWeight.Init(base.mgr)
|
||||
|
||||
p.BalanceCostThreshold = ParamItem{
|
||||
Key: "queryCoord.balanceCostThreshold",
|
||||
Version: "2.3.5",
|
||||
DefaultValue: "0.001",
|
||||
PanicIfEmpty: true,
|
||||
Doc: "the threshold of balance cost",
|
||||
Export: true,
|
||||
}
|
||||
p.BalanceCostThreshold.Init(base.mgr)
|
||||
|
||||
p.MemoryUsageMaxDifferencePercentage = ParamItem{
|
||||
Key: "queryCoord.memoryUsageMaxDifferencePercentage",
|
||||
Version: "2.0.0",
|
||||
|
|
Loading…
Reference in New Issue