diff --git a/configs/milvus.yaml b/configs/milvus.yaml index 8583da73ef..83c9ddb034 100644 --- a/configs/milvus.yaml +++ b/configs/milvus.yaml @@ -225,6 +225,7 @@ queryNode: stats: publishInterval: 1000 # Interval for querynode to report node information (milliseconds) segcore: + cgoPoolSizeRatio: 2.0 # cgo pool size ratio to max read concurrency knowhereThreadPoolNumRatio: 4 # Use more threads to make better use of SSD throughput in disk index. # This parameter is only useful when enable-disk = true. diff --git a/internal/querynodev2/segments/pool.go b/internal/querynodev2/segments/pool.go index 64750d68f8..36ccd1feb3 100644 --- a/internal/querynodev2/segments/pool.go +++ b/internal/querynodev2/segments/pool.go @@ -17,6 +17,7 @@ package segments import ( + "math" "runtime" "sync" @@ -33,8 +34,9 @@ var ( // InitPool initialize func InitPool() { initOnce.Do(func() { + pt := paramtable.Get() pool := conc.NewPool[any]( - paramtable.Get().QueryNodeCfg.MaxReadConcurrency.GetAsInt(), + int(math.Ceil(pt.QueryNodeCfg.MaxReadConcurrency.GetAsFloat()*pt.QueryNodeCfg.CGOPoolSizeRatio.GetAsFloat())), conc.WithPreAlloc(true), conc.WithDisablePurge(true), ) diff --git a/pkg/util/paramtable/component_param.go b/pkg/util/paramtable/component_param.go index 9c2e3e9c2e..325e1c33b7 100644 --- a/pkg/util/paramtable/component_param.go +++ b/pkg/util/paramtable/component_param.go @@ -1485,6 +1485,9 @@ type queryNodeConfig struct { SchedulePolicyTaskQueueExpire ParamItem `refreshable:"true"` SchedulePolicyEnableCrossUserGrouping ParamItem `refreshable:"true"` SchedulePolicyMaxPendingTaskPerUser ParamItem `refreshable:"true"` + + // CGOPoolSize ratio to MaxReadConcurrency + CGOPoolSizeRatio ParamItem `refreshable:"false"` } func (p *queryNodeConfig) init(base *BaseTable) { @@ -1839,6 +1842,14 @@ Max read concurrency must greater than or equal to 1, and less than or equal to Doc: "Max pending task per user in scheduler", } p.SchedulePolicyMaxPendingTaskPerUser.Init(base.mgr) + + p.CGOPoolSizeRatio = ParamItem{ + Key: "queryNode.segcore.cgoPoolSizeRatio", + Version: "2.3.0", + DefaultValue: "2.0", + Doc: "cgo pool size ratio to max read concurrency", + } + p.CGOPoolSizeRatio.Init(base.mgr) } // /////////////////////////////////////////////////////////////////////////////