未验证 提交 9621b661 编写于 作者: Y yah01 提交者: GitHub

Limit the concurrency level for single load request (#18400)

Signed-off-by: Nyah01 <yang.cen@zilliz.com>
上级 ef20375a
......@@ -47,6 +47,10 @@ import (
"github.com/milvus-io/milvus/internal/util/timerecord"
)
const (
requestConcurrencyLevelLimit = 8
)
// segmentLoader is only responsible for loading the field data from binlog
type segmentLoader struct {
metaReplica ReplicaInterface
......@@ -89,10 +93,19 @@ func (loader *segmentLoader) LoadSegment(req *querypb.LoadSegmentsRequest, segme
zap.Any("segmentType", segmentType.String()))
// check memory limit
concurrencyLevel := loader.cpuPool.Cap()
if concurrencyLevel > segmentNum {
concurrencyLevel = segmentNum
min := func(first int, values ...int) int {
minValue := first
for _, v := range values {
if v < minValue {
minValue = v
}
}
return minValue
}
concurrencyLevel := min(loader.cpuPool.Cap(),
len(req.Infos),
requestConcurrencyLevelLimit)
for ; concurrencyLevel > 1; concurrencyLevel /= 2 {
err := loader.checkSegmentSize(req.CollectionID, req.Infos, concurrencyLevel)
if err == nil {
......@@ -848,6 +861,10 @@ func newSegmentLoader(
panic(err)
}
log.Info("SegmentLoader created",
zap.Int("cpu-pool-size", cpuNum),
zap.Int("io-pool-size", ioPoolSize))
loader := &segmentLoader{
metaReplica: metaReplica,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册