fix: increase concurrency of DeleteObjects() to N/10th (#15546)

instead of keeping the value 10 and static, make
the concurrency a function of incoming number of
objects being deleted.
This commit is contained in:
Harshavardhana 2022-08-18 09:33:56 -07:00 committed by GitHub
parent 67cf15d036
commit bf38c0c0d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1046,8 +1046,16 @@ func (z *erasureServerPools) DeleteObjects(ctx context.Context, bucket string, o
poolObjIdxMap := map[int][]ObjectToDelete{}
origIndexMap := map[int][]int{}
// Always perform 1/10th of the number of objects per delete
concurrent := len(objects) / 10
if concurrent <= 10 {
// if we cannot get 1/10th then choose the number of
// objects as concurrent.
concurrent = len(objects)
}
var mu sync.Mutex
eg := errgroup.WithNErrs(len(objects)).WithConcurrency(10)
eg := errgroup.WithNErrs(len(objects)).WithConcurrency(concurrent)
for j, obj := range objects {
j := j
obj := obj