Skip to content

Commit

Permalink
enhance: Use common gc config (#36668)
Browse files Browse the repository at this point in the history
Use the GC config from `common` and remove the GC config from
`queryNode`.

issue: #36667

related pr: #34949

---------

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
  • Loading branch information
bigsheeper authored Oct 9, 2024
1 parent 5fc7317 commit 3685edb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 44 deletions.
4 changes: 2 additions & 2 deletions cmd/roles/roles.go
Original file line number Diff line number Diff line change
Expand Up @@ -420,10 +420,10 @@ func (mr *MilvusRoles) Run() {
action := func(GOGC uint32) {
debug.SetGCPercent(int(GOGC))
}
gc.NewTuner(paramtable.Get().CommonCfg.OverloadedMemoryThresholdPercentage.GetAsFloat(), uint32(paramtable.Get().QueryNodeCfg.MinimumGOGCConfig.GetAsInt()), uint32(paramtable.Get().QueryNodeCfg.MaximumGOGCConfig.GetAsInt()), action)
gc.NewTuner(paramtable.Get().CommonCfg.OverloadedMemoryThresholdPercentage.GetAsFloat(), uint32(paramtable.Get().CommonCfg.MinimumGOGCConfig.GetAsInt()), uint32(paramtable.Get().CommonCfg.MaximumGOGCConfig.GetAsInt()), action)
} else {
action := func(uint32) {}
gc.NewTuner(paramtable.Get().CommonCfg.OverloadedMemoryThresholdPercentage.GetAsFloat(), uint32(paramtable.Get().QueryNodeCfg.MinimumGOGCConfig.GetAsInt()), uint32(paramtable.Get().QueryNodeCfg.MaximumGOGCConfig.GetAsInt()), action)
gc.NewTuner(paramtable.Get().CommonCfg.OverloadedMemoryThresholdPercentage.GetAsFloat(), uint32(paramtable.Get().CommonCfg.MinimumGOGCConfig.GetAsInt()), uint32(paramtable.Get().CommonCfg.MaximumGOGCConfig.GetAsInt()), action)
}
}

Expand Down
2 changes: 1 addition & 1 deletion internal/querynodev2/handlers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func (suite *HandlersSuite) SetupTest() {
var err error
paramtable.Init()
suite.params = paramtable.Get()
suite.params.Save(suite.params.QueryNodeCfg.GCEnabled.Key, "false")
suite.params.Save(suite.params.CommonCfg.GCEnabled.Key, "false")

// mock factory
suite.factory = dependency.NewMockFactory(suite.T())
Expand Down
2 changes: 1 addition & 1 deletion internal/querynodev2/local_worker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ func (suite *LocalWorkerTestSuite) BeforeTest(suiteName, testName string) {
paramtable.Init()
suite.params = paramtable.Get()
// close GC at test to avoid data race
suite.params.Save(suite.params.QueryNodeCfg.GCEnabled.Key, "false")
suite.params.Save(suite.params.CommonCfg.GCEnabled.Key, "false")

suite.ctx, suite.cancel = context.WithCancel(context.Background())
// init node
Expand Down
2 changes: 1 addition & 1 deletion internal/querynodev2/server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func (suite *QueryNodeSuite) SetupTest() {
var err error
paramtable.Init()
suite.params = paramtable.Get()
suite.params.Save(suite.params.QueryNodeCfg.GCEnabled.Key, "false")
suite.params.Save(suite.params.CommonCfg.GCEnabled.Key, "false")

// mock factory
suite.factory = dependency.NewMockFactory(suite.T())
Expand Down
2 changes: 1 addition & 1 deletion internal/querynodev2/services_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ func (suite *ServiceSuite) SetupSuite() {
// collection and segments data
// init param
paramtable.Init()
paramtable.Get().Save(paramtable.Get().QueryNodeCfg.GCEnabled.Key, "false")
paramtable.Get().Save(paramtable.Get().CommonCfg.GCEnabled.Key, "false")

suite.rootPath = suite.T().Name()
suite.collectionID = 111
Expand Down
49 changes: 11 additions & 38 deletions pkg/util/paramtable/component_param.go
Original file line number Diff line number Diff line change
Expand Up @@ -265,11 +265,13 @@ type commonConfig struct {
UseVectorAsClusteringKey ParamItem `refreshable:"true"`
EnableVectorClusteringKey ParamItem `refreshable:"true"`

GCEnabled ParamItem `refreshable:"false"`
GCHelperEnabled ParamItem `refreshable:"false"`
// GC
GCEnabled ParamItem `refreshable:"false"`
GCHelperEnabled ParamItem `refreshable:"false"`
MaximumGOGCConfig ParamItem `refreshable:"false"`
MinimumGOGCConfig ParamItem `refreshable:"false"`

OverloadedMemoryThresholdPercentage ParamItem `refreshable:"false"`
MaximumGOGCConfig ParamItem `refreshable:"false"`
MinimumGOGCConfig ParamItem `refreshable:"false"`
ReadOnlyPrivileges ParamItem `refreshable:"false"`
ReadWritePrivileges ParamItem `refreshable:"false"`
AdminPrivileges ParamItem `refreshable:"false"`
Expand Down Expand Up @@ -853,13 +855,15 @@ This helps Milvus-CDC synchronize incremental data`,

p.GCEnabled = ParamItem{
Key: "common.gcenabled",
FallbackKeys: []string{"queryNode.gcenabled"},
Version: "2.4.7",
DefaultValue: "true",
}
p.GCEnabled.Init(base.mgr)

p.GCHelperEnabled = ParamItem{
Key: "common.gchelper.enabled",
FallbackKeys: []string{"queryNode.gchelper.enabled"},
Version: "2.4.7",
DefaultValue: "true",
}
Expand All @@ -878,13 +882,15 @@ This helps Milvus-CDC synchronize incremental data`,

p.MaximumGOGCConfig = ParamItem{
Key: "common.gchelper.maximumGoGC",
FallbackKeys: []string{"queryNode.gchelper.maximumGoGC"},
Version: "2.4.7",
DefaultValue: "200",
}
p.MaximumGOGCConfig.Init(base.mgr)

p.MinimumGOGCConfig = ParamItem{
Key: "common.gchelper.minimumGoGC",
FallbackKeys: []string{"queryNode.gchelper.minimumGoGC"},
Version: "2.4.7",
DefaultValue: "30",
}
Expand Down Expand Up @@ -2379,12 +2385,7 @@ type queryNodeConfig struct {
TopKMergeRatio ParamItem `refreshable:"true"`
CPURatio ParamItem `refreshable:"true"`
MaxTimestampLag ParamItem `refreshable:"true"`
GCEnabled ParamItem `refreshable:"true"`

GCHelperEnabled ParamItem `refreshable:"false"`
MinimumGOGCConfig ParamItem `refreshable:"false"`
MaximumGOGCConfig ParamItem `refreshable:"false"`
GracefulStopTimeout ParamItem `refreshable:"false"`
GracefulStopTimeout ParamItem `refreshable:"false"`

// delete buffer
MaxSegmentDeleteBuffer ParamItem `refreshable:"false"`
Expand Down Expand Up @@ -2952,34 +2953,6 @@ Max read concurrency must greater than or equal to 1, and less than or equal to
}
p.MaxTimestampLag.Init(base.mgr)

p.GCEnabled = ParamItem{
Key: "queryNode.gcenabled",
Version: "2.3.0",
DefaultValue: "true",
}
p.GCEnabled.Init(base.mgr)

p.GCHelperEnabled = ParamItem{
Key: "queryNode.gchelper.enabled",
Version: "2.0.0",
DefaultValue: "true",
}
p.GCHelperEnabled.Init(base.mgr)

p.MaximumGOGCConfig = ParamItem{
Key: "queryNode.gchelper.maximumGoGC",
Version: "2.0.0",
DefaultValue: "200",
}
p.MaximumGOGCConfig.Init(base.mgr)

p.MinimumGOGCConfig = ParamItem{
Key: "queryNode.gchelper.minimumGoGC",
Version: "2.0.0",
DefaultValue: "30",
}
p.MinimumGOGCConfig.Init(base.mgr)

p.GracefulStopTimeout = ParamItem{
Key: "queryNode.gracefulStopTimeout",
Version: "2.2.1",
Expand Down

0 comments on commit 3685edb

Please sign in to comment.