mirror of
https://github.com/pgsty/minio.git
synced 2026-07-20 04:30:26 +03:00
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:
@@ -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"`
|
||||
|
||||
Reference in New Issue
Block a user