Reduce big message RPC allocations (#19390)

Use `ODirectPoolSmall` buffers for inline data in PutObject.

Add a separate call for inline data that will fetch a buffer for the inline data before unmarshal.
This commit is contained in:
Klaus Post
2024-04-01 16:42:09 -07:00
committed by GitHub
parent 06929258bc
commit b435806d91
15 changed files with 366 additions and 65 deletions
+23
View File
@@ -21,6 +21,8 @@ import (
"time"
"github.com/minio/minio/internal/crypto"
"github.com/minio/minio/internal/grid"
xioutil "github.com/minio/minio/internal/ioutil"
)
//go:generate msgp -file=$GOFILE
@@ -433,6 +435,27 @@ type RenameDataHandlerParams struct {
Opts RenameOptions `msg:"ro"`
}
// RenameDataInlineHandlerParams are parameters for RenameDataHandler with a buffer for inline data.
type RenameDataInlineHandlerParams struct {
RenameDataHandlerParams `msg:"p"`
}
func newRenameDataInlineHandlerParams() *RenameDataInlineHandlerParams {
buf := grid.GetByteBufferCap(32 + 16<<10)
return &RenameDataInlineHandlerParams{RenameDataHandlerParams{FI: FileInfo{Data: buf[:0]}}}
}
// Recycle will reuse the memory allocated for the FileInfo data.
func (r *RenameDataInlineHandlerParams) Recycle() {
if r == nil {
return
}
if cap(r.FI.Data) >= xioutil.BlockSizeSmall {
grid.PutByteBuffer(r.FI.Data)
r.FI.Data = nil
}
}
// RenameFileHandlerParams are parameters for RenameFileHandler.
type RenameFileHandlerParams struct {
DiskID string `msg:"id"`