mirror of
https://gitee.com/milvus-io/milvus.git
synced 2026-02-04 11:18:44 +08:00
Limit the concurrency level for single load request (#18400)
Signed-off-by: yah01 <yang.cen@zilliz.com>
This commit is contained in:
parent
ef20375af2
commit
9621b6615d
@ -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,
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user