Skip to content

rpc_util: Reuse memory buffer for receiving message with stat handlers #6660

Closed as not planned
@ash2k

Description

Use case(s) - what problem will this feature solve?

Use shared buffer pool when stats handler(s) is used i.e. address the limitation documented in

grpc-go/server.go

Lines 572 to 591 in a758b62

// RecvBufferPool returns a ServerOption that configures the server
// to use the provided shared buffer pool for parsing incoming messages. Depending
// on the application's workload, this could result in reduced memory allocation.
//
// If you are unsure about how to implement a memory pool but want to utilize one,
// begin with grpc.NewSharedBufferPool.
//
// Note: The shared buffer pool feature will not be active if any of the following
// options are used: StatsHandler, EnableTracing, or binary logging. In such
// cases, the shared buffer pool will be ignored.
//
// # Experimental
//
// Notice: This API is EXPERIMENTAL and may be changed or removed in a
// later release.
func RecvBufferPool(bufferPool SharedBufferPool) ServerOption {
return newFuncServerOption(func(o *serverOptions) {
o.recvBufferPool = bufferPool
})
}

Proposed Solution

?

Alternatives Considered

?

Additional Context

See https://github.com/grpc/grpc-go/pull/5862/files#r1171991389.

Metadata

Assignees

No one assigned

    Labels

    P2Type: FeatureNew features or improvements in behavior

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions