enhance: Add growing row count weight (#30271)

Signed-off-by: sunby <sunbingyi1992@gmail.com>
pull/30336/head
Bingyi Sun 2024-01-29 14:05:02 +08:00 committed by GitHub
parent 467379d693
commit 406bf14e84
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 2 deletions

View File

@ -261,6 +261,7 @@ queryCoord:
heartbeatAvailableInterval: 10000 # 10s, Only QueryNodes which fetched heartbeats within the duration are available
loadTimeoutSeconds: 600
checkHandoffInterval: 5000
growingRowCountWeight: 4.0
# can specify ip for example
# ip: 127.0.0.1
ip: # if not specify address, will use the first unicastable address as local ip

View File

@ -149,7 +149,7 @@ func (b *ScoreBasedBalancer) calculateScore(collectionID, nodeID int64) int {
// calculate global growing segment row count
views := b.dist.GetLeaderView(nodeID)
for _, view := range views {
rowCount += int(view.NumOfGrowingRows)
rowCount += int(float64(view.NumOfGrowingRows) * params.Params.QueryCoordCfg.GrowingRowCountWeight.GetAsFloat())
}
collectionRowCount := 0
@ -162,7 +162,7 @@ func (b *ScoreBasedBalancer) calculateScore(collectionID, nodeID int64) int {
// calculate collection growing segment row count
collectionViews := b.dist.LeaderViewManager.GetByCollectionAndNode(collectionID, nodeID)
for _, view := range collectionViews {
collectionRowCount += int(view.NumOfGrowingRows)
collectionRowCount += int(float64(view.NumOfGrowingRows) * params.Params.QueryCoordCfg.GrowingRowCountWeight.GetAsFloat())
}
return collectionRowCount + int(float64(rowCount)*
params.Params.QueryCoordCfg.GlobalRowCountFactor.GetAsFloat())

View File

@ -1355,6 +1355,7 @@ type queryCoordConfig struct {
OverloadedMemoryThresholdPercentage ParamItem `refreshable:"true"`
BalanceIntervalSeconds ParamItem `refreshable:"true"`
MemoryUsageMaxDifferencePercentage ParamItem `refreshable:"true"`
GrowingRowCountWeight ParamItem `refreshable:"true"`
SegmentCheckInterval ParamItem `refreshable:"true"`
ChannelCheckInterval ParamItem `refreshable:"true"`
@ -1512,6 +1513,16 @@ func (p *queryCoordConfig) init(base *BaseTable) {
}
p.BalanceIntervalSeconds.Init(base.mgr)
p.GrowingRowCountWeight = ParamItem{
Key: "queryCoord.growingRowCountWeight",
Version: "2.3.5",
DefaultValue: "4.0",
PanicIfEmpty: true,
Doc: "the memory weight of growing segment row count",
Export: true,
}
p.GrowingRowCountWeight.Init(base.mgr)
p.MemoryUsageMaxDifferencePercentage = ParamItem{
Key: "queryCoord.memoryUsageMaxDifferencePercentage",
Version: "2.0.0",