benchmark
packageThis package is not in the latest version of its module.
Details
Validgo.mod file
The Go module system was introduced in Go 1.11 and is the official dependency management solution for Go.
Redistributable license
Redistributable licenses place minimal restrictions on how software can be used, modified, and redistributed.
Tagged version
Modules with tagged versions give importers more predictable builds.
Stable version
When a project reaches major version v1 it is considered stable.
- Learn more about best practices
Repository
Links
Documentation¶
Overview¶
Package benchmark implements the building blocks to setup end-to-end gRPC benchmarks.
Index¶
- Constants
- func DoByteBufStreamingRoundTrip(stream testgrpc.BenchmarkService_StreamingCallClient, reqSize, _ int) error
- func DoStreamingRoundTrip(stream testgrpc.BenchmarkService_StreamingCallClient, reqSize, respSize int) error
- func DoStreamingRoundTripPreloaded(stream testgrpc.BenchmarkService_StreamingCallClient, req any) error
- func DoUnaryCall(tc testgrpc.BenchmarkServiceClient, reqSize, respSize int) error
- func NewClientConn(addr string, opts ...grpc.DialOption) *grpc.ClientConn
- func NewClientConnWithContext(_ context.Context, addr string, opts ...grpc.DialOption) *grpc.ClientConn
- func NewPayload(t testpb.PayloadType, size int) *testpb.Payload
- func StartServer(info ServerInfo, opts ...grpc.ServerOption) func()
- type ServerInfo
Constants¶
const PreloadMsgSizeHeader = "preload-msg-size"PreloadMsgSizeHeader indicates that the client is going to ask fora fixed response size and passes this size to the server.The server is expected to preload the response on startup.
const UnconstrainedStreamingDelayHeader = "unconstrained-streaming-delay"UnconstrainedStreamingDelayHeader is used to pass the maximum amount of timethe server should sleep between consecutive RPC responses.
const UnconstrainedStreamingHeader = "unconstrained-streaming"UnconstrainedStreamingHeader indicates to the StreamingCall handler that itsbehavior should be unconstrained (constant send/receive in parallel) insteadof ping-pong.
Variables¶
This section is empty.
Functions¶
funcDoByteBufStreamingRoundTrip¶
func DoByteBufStreamingRoundTrip(streamtestgrpc.BenchmarkService_StreamingCallClient, reqSize, _int)error
DoByteBufStreamingRoundTrip performs a round trip for a single streaming rpc, using a custom codec for byte buffer.
funcDoStreamingRoundTrip¶
func DoStreamingRoundTrip(streamtestgrpc.BenchmarkService_StreamingCallClient, reqSize, respSizeint)error
DoStreamingRoundTrip performs a round trip for a single streaming rpc.
funcDoStreamingRoundTripPreloaded¶added inv1.57.0
func DoStreamingRoundTripPreloaded(streamtestgrpc.BenchmarkService_StreamingCallClient, reqany)error
DoStreamingRoundTripPreloaded performs a round trip for a single streaming rpc with preloaded payload.
funcDoUnaryCall¶
func DoUnaryCall(tctestgrpc.BenchmarkServiceClient, reqSize, respSizeint)error
DoUnaryCall performs a unary RPC with given stub and request and response sizes.
funcNewClientConn¶
func NewClientConn(addrstring, opts ...grpc.DialOption) *grpc.ClientConn
NewClientConn creates a gRPC client connection to addr.
funcNewClientConnWithContext¶added inv1.13.0
func NewClientConnWithContext(_context.Context, addrstring, opts ...grpc.DialOption) *grpc.ClientConn
NewClientConnWithContext creates a gRPC client connection to addr using ctx.
funcNewPayload¶added inv1.18.0
func NewPayload(ttestpb.PayloadType, sizeint) *testpb.Payload
NewPayload creates a payload with the given type and size.
funcStartServer¶
func StartServer(infoServerInfo, opts ...grpc.ServerOption) func()
StartServer starts a gRPC server serving a benchmark service according to info.It returns a function to stop the server.
Types¶
typeServerInfo¶
type ServerInfo struct {// Type is the type of the server.// It should be "protobuf" or "bytebuf".Typestring// Metadata is an optional configuration.// For "protobuf", it's ignored.// For "bytebuf", it should be an int representing response size.Metadataany// Listener is the network listener for the server to useListenernet.Listener}ServerInfo contains the information to create a gRPC benchmark server.
Directories¶
| Path | Synopsis |
|---|---|
Package main provides benchmark with setting flags. | Package main provides benchmark with setting flags. |
To format the benchmark result: | To format the benchmark result: |
Package main provides a client used for benchmarking. | Package main provides a client used for benchmarking. |
Package flags provide convenience types and routines to accept specific types of flag values on the command line. | Package flags provide convenience types and routines to accept specific types of flag values on the command line. |
Package latency provides wrappers for net.Conn, net.Listener, and net.Dialers, designed to interoperate to inject real-world latency into network connections. | Package latency provides wrappers for net.Conn, net.Listener, and net.Dialers, designed to interoperate to inject real-world latency into network connections. |
Package main provides a server used for benchmarking. | Package main provides a server used for benchmarking. |
Package stats tracks the statistics associated with benchmark runs. | Package stats tracks the statistics associated with benchmark runs. |
Binary worker implements the benchmark worker that can turn into a benchmark client or server. | Binary worker implements the benchmark worker that can turn into a benchmark client or server. |