benchmark

package
v1.39.1-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 22, 2021 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package benchmark implements the building blocks to setup end-to-end gRPC benchmarks.

Index

Constants

View Source
const UnconstrainedStreamingHeader = "unconstrained-streaming"

UnconstrainedStreamingHeader indicates to the StreamingCall handler that its behavior should be unconstrained (constant send/receive in parallel) instead of ping-pong.

Variables

This section is empty.

Functions

func DoByteBufStreamingRoundTrip

func DoByteBufStreamingRoundTrip(stream testgrpc.BenchmarkService_StreamingCallClient, reqSize, respSize int) error

DoByteBufStreamingRoundTrip performs a round trip for a single streaming rpc, using a custom codec for byte buffer.

func DoStreamingRoundTrip

func DoStreamingRoundTrip(stream testgrpc.BenchmarkService_StreamingCallClient, reqSize, respSize int) error

DoStreamingRoundTrip performs a round trip for a single streaming rpc.

func DoUnaryCall

func DoUnaryCall(tc testgrpc.BenchmarkServiceClient, reqSize, respSize int) error

DoUnaryCall performs an unary RPC with given stub and request and response sizes.

func NewClientConn

func NewClientConn(addr string, opts ...grpc.DialOption) *grpc.ClientConn

NewClientConn creates a gRPC client connection to addr.

func NewClientConnWithContext added in v1.13.0

func NewClientConnWithContext(ctx context.Context, addr string, opts ...grpc.DialOption) *grpc.ClientConn

NewClientConnWithContext creates a gRPC client connection to addr using ctx.

func NewPayload

func NewPayload(t testpb.PayloadType, size int) *testpb.Payload

NewPayload creates a payload with the given type and size.

func StartServer

func StartServer(info ServerInfo, 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

type ServerInfo

type ServerInfo struct {
	// Type is the type of the server.
	// It should be "protobuf" or "bytebuf".
	Type string

	// Metadata is an optional configuration.
	// For "protobuf", it's ignored.
	// For "bytebuf", it should be an int representing response size.
	Metadata interface{}

	// Listener is the network listener for the server to use
	Listener net.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: go run benchmark/benchresult/main.go resultfile To see the performance change based on a old result: go run benchmark/benchresult/main.go resultfile_old resultfile It will print the comparison result of intersection benchmarks between two files.
To format the benchmark result: go run benchmark/benchresult/main.go resultfile To see the performance change based on a old result: go run benchmark/benchresult/main.go resultfile_old resultfile It will print the comparison result of intersection benchmarks between two files.
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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL