grpc: Index | Files | Directories

package benchmark

import ""

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


Package Files


func AddOne Uses

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

AddOne add 1 to the features slice

func DoByteBufStreamingRoundTrip Uses

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 Uses

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

DoStreamingRoundTrip performs a round trip for a single streaming rpc.

func DoUnaryCall Uses

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

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

func NewClientConn Uses

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

NewClientConn creates a gRPC client connection to addr.

func StartServer Uses

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.

type ServerInfo Uses

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.


benchmainPackage main provides benchmark with setting flags.
benchresultTo format the benchmark result: go run benchmark/benchresult/main.go resultfile
grpc_testingPackage grpc_testing is a generated protocol buffer package.
latencyPackage latency provides wrappers for net.Conn, net.Listener, and net.Dialers, designed to interoperate to inject real-world latency into network connections.

Package benchmark imports 12 packages (graph) and is imported by 23 packages. Updated 2017-12-07. Refresh now. Tools for package owners.