benchmark

package
v0.0.0-...-52d6a69 Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2019 License: Apache-2.0, Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

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 StartServer

func StartServer(info ServerInfo, opts ...grpc.ServerOption) (string, func())

StartServer starts a gRPC server serving a benchmark service according to info. It returns its listen address and a function to stop the server.

Types

type Features

type Features struct {
	EnableTrace        bool
	Latency            time.Duration
	Kbps               int
	Mtu                int
	MaxConcurrentCalls int
	ReqSizeBytes       int
	RespSizeBytes      int
	EnableCompressor   bool
}

Features contains most fields for a benchmark

func (Features) String

func (f Features) String() string

type ServerInfo

type ServerInfo struct {
	// Addr is the address of the server.
	Addr string

	// 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{}

	// Network can simulate latency
	Network *latency.Network
}

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.
Package grpc_testing is a generated protocol buffer package.
Package grpc_testing is a generated protocol buffer package.
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.

Jump to

Keyboard shortcuts

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