Documentation ¶
Overview ¶
package wrench provides a generic framework for performing latency benchmarks.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var Logarithmic = Percentiles{}/* 168 elements not displayed */
Logarithmic percentile scale.
Functions ¶
func DetermineClockSkew ¶
DetermineClockSkew checks the options on whether this instance is a) a subscriber and then opens a listening port to receive the time from a publisher or b) a publisher and tries to connect to the subscriber to publish its time
Types ¶
type BasePublisher ¶
type BasePublisher struct { // ID of the Publisher instance ID uint64 }
BasePublisher provides methods common to all Publisher implementations
func (*BasePublisher) GetID ¶
func (b *BasePublisher) GetID() uint64
GetID returns the Id of the Publisher
type BaseSubscriber ¶
type BaseSubscriber struct { ID uint64 // contains filtered or unexported fields }
BaseSubscriber contains all shared methods for Subscriber implementations
func (*BaseSubscriber) BaseSetup ¶
func (s *BaseSubscriber) BaseSetup(o *config.Options)
BaseSetup will initialize all fields of BaseSubscriber struct
func (*BaseSubscriber) BaseTeardown ¶
func (s *BaseSubscriber) BaseTeardown()
BaseTeardown should be called from Subscriber impl's teardown method to finish tasks in BaseSubscriber
func (*BaseSubscriber) CheckForCompletion ¶
func (s *BaseSubscriber) CheckForCompletion() error
CheckForCompletion checks if all messages have been fetched
func (*BaseSubscriber) RecordLatency ¶
func (s *BaseSubscriber) RecordLatency(msg *[]byte)
RecordLatency will calculate the latency from the timestamp inside the provided byte-slice and put it to hdrhistogram. It also returns the calculated latency for further usage.
func (*BaseSubscriber) Summarize ¶
func (s *BaseSubscriber) Summarize() *Summary
Summarize can/should be called to create a Summary object
type Benchmark ¶
Benchmark performs a system benchmark by attempting to issue requests at a specified rate and capturing the latency distribution. The request rate is divided across the number of configured connections.
func NewBenchmark ¶
func NewBenchmark(factory ConnectorFactory, o *config.Options) *Benchmark
NewBenchmark creates a Benchmark which runs a system benchmark using the given ConnectorFactory. The requestRate argument specifies the number of requests per second to issue. This value is divided across the number of connections specified, so if requestRate is 50,000 and connections is 10, each connection will attempt to issue 5,000 requests per second. A zero value permanently pauses requests and -1 disables rate limiting entirely. The duration argument specifies how long to run the benchmark.
type ConnectorFactory ¶
type ConnectorFactory interface { PublisherFactory SubscriberFactory }
ConnectorFactory combines PublisherFactory and SubscriberFactory
type Percentiles ¶
type Percentiles []float64
Percentiles is a list of percentiles to include in a latency distribution, e.g. 10.0, 50.0, 99.0, 99.99, etc.
type PubSummary ¶
type PubSummary struct { NumPubs uint64 AvgPublishRate uint64 SuccessTotal uint64 ErrorTotal uint64 TimeElapsed time.Duration TotalAvgThroughput float64 PublishRates []config.PublishRateChange AvgThroughputPerPublishRate []float64 BytesTotal uint64 BytesAvgThroughput float64 }
PubSummary holds all statistic summary data for publishers
func (*PubSummary) String ¶
func (s *PubSummary) String() string
String returns a stringified version of the Summary.
type Publisher ¶
type Publisher interface { // Setup prepares the Publisher for benchmarking. Setup() error // Publish performs a request to the system under test. Publish(payload *[]byte) error // Teardown is called upon benchmark completion. Teardown() error // GetID returns the Id of the Publisher GetID() uint64 }
Publisher issues requests for a particular system under test.
type PublisherFactory ¶
type PublisherFactory interface { // GetPublisher returns a new Publisher, called for each Benchmark // connection. GetPublisher(number uint64) Publisher }
PublisherFactory creates new Publishers.
type SubSummary ¶
type SubSummary struct { NumSubs uint64 ReceivedTotal uint64 TimeElapsed time.Duration AvgReceiveRate float64 SuccessHistogram *hdrhistogram.Histogram BytesTotal uint64 BytesAvgThroughput float64 }
SubSummary holds all statistic summary data for subscribers
func (*SubSummary) String ¶
func (s *SubSummary) String() string
String returns a stringified version of the Summary.
type Subscriber ¶
type Subscriber interface { // setup prepares the Subscriber for benchmarking. Setup(opts *config.Options) error // Start receiving CheckForCompletion() error // Teardown is called upon benchmark completion. Teardown() error // Summarize the results Summarize() *Summary }
Subscriber reads messages from the system under test.
type SubscriberFactory ¶
type SubscriberFactory interface { // GetSubscriber returns a new Subscriber GetSubscriber(number uint64) Subscriber }
SubscriberFactory creates new Subscriber instances
type Summary ¶
type Summary struct { Pub *PubSummary Sub *SubSummary }
Summary contains the results of a Benchmark run.
func (*Summary) GenerateLatencyDistribution ¶
func (s *Summary) GenerateLatencyDistribution(percentiles Percentiles, file string) error
GenerateLatencyDistribution generates a text file containing the specified latency distribution in a format plottable by http://hdrhistogram.github.io/HdrHistogram/plotFiles.html. Percentiles is a list of percentiles to include, e.g. 10.0, 50.0, 99.0, 99.99, etc. If percentiles is nil, it defaults to a logarithmic percentile scale. If a request rate was specified for the benchmark, this will also generate an uncorrected distribution file which does not account for coordinated omission.
func (*Summary) WriteRequestRatesAndThroughput ¶
WriteRequestRatesAndThroughput writes a CSV file containing the request rate schedule and the actual measured throughputs