benchmark

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2016 License: MIT Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var BenchmarkDir = "./"

BenchmarkDir should be set to the benchmark source directory.

Functions

This section is empty.

Types

type Client

type Client interface {
	// Warmup will create connections to all host:ports the client was created with.
	Warmup() error

	// RawCall makes an echo call using raw.
	RawCall(n int) ([]time.Duration, error)

	// ThriftCall makes an echo call using thrift.
	ThriftCall(n int) ([]time.Duration, error)

	// Close closes the benchmark client.
	Close()
}

Client is a benchmark client that can be used to call a benchmark server.

func NewClient

func NewClient(hosts []string, optFns ...Option) Client

NewClient returns a new Client that can make calls to a benchmark server.

type Option

type Option func(*options)

Option represents a Benchmark option.

func WithAdvertiseHosts

func WithAdvertiseHosts(hosts []string) Option

WithAdvertiseHosts sets the hosts to advertise with on startup.

func WithExternalProcess

func WithExternalProcess() Option

WithExternalProcess creates a separate process to host the server/client.

func WithNoChecking

func WithNoChecking() Option

WithNoChecking disables result verification on the client side, which may slow down the client (as it compares all request bytes against the response bytes).

func WithNoDurations

func WithNoDurations() Option

WithNoDurations disables printing of latencies to standard out.

func WithNoLibrary

func WithNoLibrary() Option

WithNoLibrary uses the fast TCP-template based approach for generating TChannel frames rather than the TChannel client library.

func WithNumClients

func WithNumClients(numClients int) Option

WithNumClients sets the number of concurrent TChannel clients to use internally under a single benchmark.Client. This is used to generate generate a large amount of traffic, as a single TChannel client will not saturate a CPU since it will spend most of the time blocking and waiting for the remote side to respond.

func WithRequestSize

func WithRequestSize(reqSize int) Option

WithRequestSize sets the request size for each call.

func WithServiceName

func WithServiceName(svcName string) Option

WithServiceName sets the service name of the benchmark server.

func WithTimeout

func WithTimeout(timeout time.Duration) Option

WithTimeout sets the timeout to use for each call.

type Relay

type Relay interface {
	// HostPort is the host:port that the relay is listening on.
	HostPort() string

	// Close clsoes the relay.
	Close()
}

Relay represents a relay for benchmarking.

func NewRealRelay

func NewRealRelay(services map[string][]string) (Relay, error)

NewRealRelay creates a TChannel relay.

func NewTCPFrameRelay

func NewTCPFrameRelay(dests []string, modifier func(bool, *tchannel.Frame) *tchannel.Frame) (Relay, error)

NewTCPFrameRelay relays frames from one connection to another. It reads and writes frames using the TChannel frame functions.

func NewTCPRawRelay

func NewTCPRawRelay(dests []string) (Relay, error)

NewTCPRawRelay creates a relay that just pipes data from one connection to another directly.

type Server

type Server interface {
	// HostPort returns the HostPort that the server is listening on.
	HostPort() string

	// Close closes the benchmark server.
	Close()

	// RawCalls returns the number of raw calls the server has received.
	RawCalls() int

	// ThriftCalls returns the number of Thrift calls the server has received.
	ThriftCalls() int
}

Server is a benchmark server that can receive requests.

func NewServer

func NewServer(optFns ...Option) Server

NewServer returns a new Server that can recieve Thrift calls or raw calls.

Directories

Path Synopsis
benchclient is used to make requests to a specific server.
benchclient is used to make requests to a specific server.
benchserver is used to receive requests for benchmarks.
benchserver is used to receive requests for benchmarks.

Jump to

Keyboard shortcuts

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