package benchmark

import "google.golang.org/grpc/benchmark"

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

Index

Functions

func AddOne

func AddOne(features []int, featuresMaxPosition []int)

AddOne add 1 to the features slice

func DoByteBufStreamingRoundTrip

func DoByteBufStreamingRoundTrip(stream testpb.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 testpb.BenchmarkService_StreamingCallClient, reqSize, respSize int) error

DoStreamingRoundTrip performs a round trip for a single streaming rpc.

func DoUnaryCall

func DoUnaryCall(tc testpb.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

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.

Source Files

benchmark.go

Directories

PathSynopsis
benchmark/benchmainPackage main provides benchmark with setting flags.
benchmark/benchresultTo format the benchmark result:
benchmark/client
benchmark/grpc_testing
benchmark/latencyPackage latency provides wrappers for net.Conn, net.Listener, and net.Dialers, designed to interoperate to inject real-world latency into network connections.
benchmark/primitives
benchmark/server
benchmark/stats
benchmark/worker
Version
v1.18.1
Published
Mar 20, 2019
Platform
js/wasm
Imports
15 packages
Last checked
8 minutes ago

Tools for package owners.