package benchmark
import "github.com/uber/tchannel-go/benchmark"
Index ¶
- Variables
- type Client
- type Option
- func WithAdvertiseHosts(hosts []string) Option
- func WithExternalProcess() Option
- func WithNoChecking() Option
- func WithNoDurations() Option
- func WithNoLibrary() Option
- func WithNumClients(numClients int) Option
- func WithRequestSize(reqSize int) Option
- func WithServiceName(svcName string) Option
- func WithTimeout(timeout time.Duration) Option
- type Relay
- func NewRealRelay(services map[string][]string, appends []relay.KeyVal) (Relay, error)
- func NewTCPFrameRelay(dests []string, modifier func(bool, *tchannel.Frame) *tchannel.Frame) (Relay, error)
- func NewTCPRawRelay(dests []string) (Relay, error)
- type Server
Variables ¶
var BenchmarkDir = "./"
BenchmarkDir should be set to the benchmark source directory.
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 ¶
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 ¶
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 ¶
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 ¶
WithRequestSize sets the request size for each call.
func WithServiceName ¶
WithServiceName sets the service name of the benchmark server.
func WithTimeout ¶
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 ¶
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 ¶
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 ¶
NewServer returns a new Server that can recieve Thrift calls or raw calls.
Source Files ¶
build_manager.go external_client.go external_common.go external_server.go frame_templates.go interfaces.go internal_client.go internal_multi_client.go internal_server.go internal_tcp_client.go internal_tcp_server.go options.go real_relay.go req_bytes.go tcp_frame_relay.go tcp_raw_relay.go
Directories ¶
Path | Synopsis |
---|---|
benchmark/benchclient | benchclient is used to make requests to a specific server. |
benchmark/benchserver | benchserver is used to receive requests for benchmarks. |
- Version
- v1.34.6 (latest)
- Published
- Jan 8, 2025
- Platform
- darwin/amd64
- Imports
- 26 packages
- Last checked
- 56 seconds ago –
Tools for package owners.