From df1b33013f720a3dbd82e84cb59e5dfefe5cdb1d Mon Sep 17 00:00:00 2001 From: Harshavardhana Date: Fri, 1 Jun 2018 16:41:23 -0700 Subject: [PATCH] Fix byte pool usage, use only one pool for all sets. (#5990) --- cmd/xl-sets.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/xl-sets.go b/cmd/xl-sets.go index 311217197..085acf9f2 100644 --- a/cmd/xl-sets.go +++ b/cmd/xl-sets.go @@ -243,6 +243,11 @@ func newXLSets(endpoints EndpointList, format *formatXLV3, setCount int, drivesP } mutex := newNSLock(globalIsDistXL) + + // Initialize byte pool once for all sets, bpool size is set to + // setCount * drivesPerSet with each memory upto blockSizeV1. + bp := bpool.NewBytePoolCap(setCount*drivesPerSet, blockSizeV1, blockSizeV1*2) + for i := 0; i < len(format.XL.Sets); i++ { s.xlDisks[i] = make([]StorageAPI, drivesPerSet) @@ -250,7 +255,7 @@ func newXLSets(endpoints EndpointList, format *formatXLV3, setCount int, drivesP s.sets[i] = &xlObjects{ getDisks: s.GetDisks(i), nsMutex: mutex, - bp: bpool.NewBytePoolCap(setCount*drivesPerSet, blockSizeV1, blockSizeV1*2), + bp: bp, } go s.sets[i].cleanupStaleMultipartUploads(context.Background(), globalMultipartCleanupInterval, globalMultipartExpiry, globalServiceDoneCh) }