mirror of
https://github.com/minio/minio.git
synced 2025-09-30 18:12:11 +02:00
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:
parent
67cf15d036
commit
bf38c0c0d1
@ -1046,8 +1046,16 @@ func (z *erasureServerPools) DeleteObjects(ctx context.Context, bucket string, o
|
|||||||
poolObjIdxMap := map[int][]ObjectToDelete{}
|
poolObjIdxMap := map[int][]ObjectToDelete{}
|
||||||
origIndexMap := map[int][]int{}
|
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
|
var mu sync.Mutex
|
||||||
eg := errgroup.WithNErrs(len(objects)).WithConcurrency(10)
|
eg := errgroup.WithNErrs(len(objects)).WithConcurrency(concurrent)
|
||||||
for j, obj := range objects {
|
for j, obj := range objects {
|
||||||
j := j
|
j := j
|
||||||
obj := obj
|
obj := obj
|
||||||
|
Loading…
x
Reference in New Issue
Block a user