fix: increase the tiering part size to 128MiB (#19424)

also introduce 8MiB buffer to read from for
bigger parts
This commit is contained in:
Harshavardhana 2024-04-08 02:22:27 -07:00 committed by GitHub
parent 04101d472f
commit c957e0d426
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 24 additions and 11 deletions

View File

@ -142,7 +142,7 @@ func (t *apiConfig) init(cfg api.Config, setDriveCounts []int) {
// total_ram / ram_per_request
// ram_per_request is (2MiB+128KiB) * driveCount \
// + 2 * 10MiB (default erasure block size v1) + 2 * 1MiB (default erasure block size v2)
blockSize := xioutil.BlockSizeLarge + xioutil.BlockSizeSmall
blockSize := xioutil.LargeBlock + xioutil.SmallBlock
apiRequestsMaxPerNode = int(maxMem / uint64(maxSetDrives*blockSize+int(blockSizeV1*2+blockSizeV2*2)))
if globalIsDistErasure {
logger.Info("Automatically configured API requests per node based on available memory on the system: %d", apiRequestsMaxPerNode)

View File

@ -450,7 +450,7 @@ func (r *RenameDataInlineHandlerParams) Recycle() {
if r == nil {
return
}
if cap(r.FI.Data) >= xioutil.BlockSizeSmall {
if cap(r.FI.Data) >= xioutil.SmallBlock {
grid.PutByteBuffer(r.FI.Data)
r.FI.Data = nil
}

View File

@ -595,6 +595,8 @@ func (s *storageRESTServer) ReadFileStreamHandler(w http.ResponseWriter, r *http
// Windows can lock up with this optimization, so we fall back to regular copy.
sr, ok := rc.(*sendFileReader)
if ok {
// Sendfile sends in 4MiB chunks per sendfile syscall which is more than enough
// for most setups.
_, err = rf.ReadFrom(sr.Reader)
if !xnet.IsNetworkOrHostDown(err, true) { // do not need to log disconnected clients
storageLogIf(r.Context(), err)

View File

@ -42,7 +42,7 @@ const (
maxMultipartPutObjectSize = 1024 * 1024 * 1024 * 1024 * 5
maxPartsCount = 10000
maxPartSize = 1024 * 1024 * 1024 * 5
minPartSize = 1024 * 1024 * 64 // chosen by us to be optimal for HDDs
minPartSize = 1024 * 1024 * 128 // chosen by us to be optimal for HDDs
)
// optimalPartInfo - calculate the optimal part info for a given

View File

@ -2131,11 +2131,15 @@ func (s *xlStorage) writeAllDirect(ctx context.Context, filePath string, fileSiz
var bufp *[]byte
switch {
case fileSize > 0 && fileSize >= xioutil.BlockSizeReallyLarge:
case fileSize > 0 && fileSize >= xioutil.XXLargeBlock*2:
// use a larger 8MiB buffer for a really really large streamsx.
bufp = xioutil.ODirectPoolXXLarge.Get().(*[]byte)
defer xioutil.ODirectPoolXXLarge.Put(bufp)
case fileSize > 0 && fileSize >= xioutil.XLargeBlock:
// use a larger 4MiB buffer for a really large streams.
bufp = xioutil.ODirectPoolXLarge.Get().(*[]byte)
defer xioutil.ODirectPoolXLarge.Put(bufp)
case fileSize <= xioutil.BlockSizeSmall:
case fileSize <= xioutil.SmallBlock:
bufp = xioutil.ODirectPoolSmall.Get().(*[]byte)
defer xioutil.ODirectPoolSmall.Put(bufp)
default:

View File

@ -34,28 +34,35 @@ import (
// Block sizes constant.
const (
BlockSizeSmall = 32 * humanize.KiByte // Default r/w block size for smaller objects.
BlockSizeLarge = 1 * humanize.MiByte // Default r/w block size for normal objects.
BlockSizeReallyLarge = 4 * humanize.MiByte // Default r/w block size for very large objects.
SmallBlock = 32 * humanize.KiByte // Default r/w block size for smaller objects.
LargeBlock = 1 * humanize.MiByte // Default r/w block size for normal objects.
XLargeBlock = 4 * humanize.MiByte // Default r/w block size for very large objects.
XXLargeBlock = 8 * humanize.MiByte // Default r/w block size for very very large objects.
)
// aligned sync.Pool's
var (
ODirectPoolXXLarge = sync.Pool{
New: func() interface{} {
b := disk.AlignedBlock(XXLargeBlock)
return &b
},
}
ODirectPoolXLarge = sync.Pool{
New: func() interface{} {
b := disk.AlignedBlock(BlockSizeReallyLarge)
b := disk.AlignedBlock(XLargeBlock)
return &b
},
}
ODirectPoolLarge = sync.Pool{
New: func() interface{} {
b := disk.AlignedBlock(BlockSizeLarge)
b := disk.AlignedBlock(LargeBlock)
return &b
},
}
ODirectPoolSmall = sync.Pool{
New: func() interface{} {
b := disk.AlignedBlock(BlockSizeSmall)
b := disk.AlignedBlock(SmallBlock)
return &b
},
}