Make cgo pool size larger than worker pool size (#25318)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/25344/head
congqixia 2023-07-05 16:56:26 +08:00 committed by GitHub
parent c2a2ece551
commit efdd71c640
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -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.

View File

@ -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),
)

View File

@ -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)
}
// /////////////////////////////////////////////////////////////////////////////