Fix byte pool usage, use only one pool for all sets. (#5990)

This commit is contained in:
Harshavardhana 2018-06-01 16:41:23 -07:00 committed by kannappanr
parent 537fd8c821
commit df1b33013f

View File

@ -243,6 +243,11 @@ func newXLSets(endpoints EndpointList, format *formatXLV3, setCount int, drivesP
} }
mutex := newNSLock(globalIsDistXL) 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++ { for i := 0; i < len(format.XL.Sets); i++ {
s.xlDisks[i] = make([]StorageAPI, drivesPerSet) s.xlDisks[i] = make([]StorageAPI, drivesPerSet)
@ -250,7 +255,7 @@ func newXLSets(endpoints EndpointList, format *formatXLV3, setCount int, drivesP
s.sets[i] = &xlObjects{ s.sets[i] = &xlObjects{
getDisks: s.GetDisks(i), getDisks: s.GetDisks(i),
nsMutex: mutex, nsMutex: mutex,
bp: bpool.NewBytePoolCap(setCount*drivesPerSet, blockSizeV1, blockSizeV1*2), bp: bp,
} }
go s.sets[i].cleanupStaleMultipartUploads(context.Background(), globalMultipartCleanupInterval, globalMultipartExpiry, globalServiceDoneCh) go s.sets[i].cleanupStaleMultipartUploads(context.Background(), globalMultipartCleanupInterval, globalMultipartExpiry, globalServiceDoneCh)
} }