Index parallel respect CPU quota (#14991)

Signed-off-by: Congqi Xia <congqi.xia@zilliz.com>
pull/15029/head
congqixia 2022-01-07 17:31:22 +08:00 committed by GitHub
parent c105587ee1
commit fc256e7924
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions

View File

@ -340,7 +340,10 @@ func (it *IndexBuildTask) Execute(ctx context.Context) error {
return nil
}
err = funcutil.ProcessFuncParallel(len(toLoadDataPaths), runtime.NumCPU(), loadKey, "loadKey")
// Use runtime.GOMAXPROCS(0) instead of runtime.NumCPU()
// to respect CPU quota of container/pod
// gomaxproc will be set by `automaxproc`, passing 0 will just retrieve the value
err = funcutil.ProcessFuncParallel(len(toLoadDataPaths), runtime.GOMAXPROCS(0), loadKey, "loadKey")
if err != nil {
log.Warn("loadKey from minio failed", zap.Error(err))
it.internalErr = err