Documentation
¶
Index ¶
- Constants
- func AvgLatency(latencies []uint64) float64
- func GetBenchTypeLabel(benchType string) string
- func MaxLatency(latencies []uint64) float64
- func MinLatency(latencies []uint64) float64
- func PercentileLatency(latencies []uint64, percentile float64) float64
- func StdLatency(latencies []uint64) float64
- type BenchSample
- type BenchSampleGroup
- func (sg *BenchSampleGroup) AddSample(e *BenchSample)
- func (sg *BenchSampleGroup) AvgMsgRate() int64
- func (sg *BenchSampleGroup) HasSamples() bool
- func (sg *BenchSampleGroup) LatencyStatistics() string
- func (sg *BenchSampleGroup) MaxLatency() uint64
- func (sg *BenchSampleGroup) MaxMsgRate() int64
- func (sg *BenchSampleGroup) MinLatency() uint64
- func (sg *BenchSampleGroup) MinMsgRate() int64
- func (sg *BenchSampleGroup) MsgRateStatistics() string
- func (sg *BenchSampleGroup) StdDevMsgs() float64
- type BenchmarkResults
Constants ¶
const ( DefaultDurableConsumerName = "nats-bench" DefaultStreamName = "benchstream" DefaultBucketName = "benchbucket" DefaultServiceName = "nats-bench-service" DefaultServiceVersion = "1.0.0" TypeCorePub = "pub" TypeCoreSub = "sub" TypeServiceRequest = "request" TypeServiceServe = "reply" TypeJSPubSync = "jsyncpub" TypeJSPubAsync = "jsasyncpub" TypeJSPubBatch = "jsbatchpub" TypeJSOrdered = "jsordered" TypeJSConsume = "jsconsume" TypeJSFetch = "jsfetch" TypeJSGetSync = "jsgetdirectsync" TypeJSGetDirectBatched = "jsgetdirectbatch" TypeOldJSOrdered = "oldjsordered" TypeOldJSPush = "oldjspush" TypeOldJSPull = "oldjspull" TypeKVPut = "kvput" TypeKVGet = "kvget" AckModeNone = "none" AckModeAll = "all" AckModeExplicit = "explicit" )
Variables ¶
This section is empty.
Functions ¶
func AvgLatency ¶ added in v0.3.1
AvgLatency returns the average latency in microseconds
func GetBenchTypeLabel ¶
func MaxLatency ¶ added in v0.3.1
MaxLatency returns the maximum latency in microseconds
func MinLatency ¶ added in v0.3.1
MinLatency returns the minimum latency in microseconds
func PercentileLatency ¶ added in v0.3.1
PercentileLatency returns the given percentile latency in microseconds
func StdLatency ¶ added in v0.3.1
StdLatency returns the standard deviation of the latencies in microseconds
Types ¶
type BenchSample ¶
type BenchSample struct {
// contains filtered or unexported fields
}
A BenchSample for a particular client
func NewSample ¶
func NewSample(jobCount int, msgSize int, start, end time.Time, latencies []uint64, nc *nats.Conn) *BenchSample
NewSample creates a new BenchSample initialized to the provided values. The nats.Conn information captured
func (*BenchSample) Duration ¶
func (s *BenchSample) Duration() time.Duration
Duration that the BenchSample was active
func (*BenchSample) Rate ¶
func (s *BenchSample) Rate() int64
Rate of messages in the job per second
func (*BenchSample) String ¶
func (s *BenchSample) String() string
String generates a human-readable report of the BenchSample
func (*BenchSample) Throughput ¶
func (s *BenchSample) Throughput() float64
Throughput of bytes per second
type BenchSampleGroup ¶
type BenchSampleGroup struct {
BenchSample
// contains filtered or unexported fields
}
BenchSampleGroup for a number of samples, the group is a BenchSample itself aggregating the values the samples
func (*BenchSampleGroup) AddSample ¶
func (sg *BenchSampleGroup) AddSample(e *BenchSample)
AddSample adds a BenchSample to the SampleGroup. After adding a BenchSample it shouldn't be modified.
func (*BenchSampleGroup) AvgMsgRate ¶
func (sg *BenchSampleGroup) AvgMsgRate() int64
AvgMsgRate returns the average of all the message rates in the SampleGroup
func (*BenchSampleGroup) HasSamples ¶
func (sg *BenchSampleGroup) HasSamples() bool
HasSamples returns true if the group has samples
func (*BenchSampleGroup) LatencyStatistics ¶
func (sg *BenchSampleGroup) LatencyStatistics() string
LatencyStatistics prints statistics for the average latencies in microseconds of the BenchSample group (min, average, max and standard deviation)
func (*BenchSampleGroup) MaxLatency ¶
func (sg *BenchSampleGroup) MaxLatency() uint64
MaxLatency returns the largest average latency in microseconds in the SampleGroup
func (*BenchSampleGroup) MaxMsgRate ¶
func (sg *BenchSampleGroup) MaxMsgRate() int64
MaxMsgRate returns the largest message Rate in the SampleGroup
func (*BenchSampleGroup) MinLatency ¶
func (sg *BenchSampleGroup) MinLatency() uint64
MinLatency returns the smallest average latency in microseconds in the SampleGroup
func (*BenchSampleGroup) MinMsgRate ¶
func (sg *BenchSampleGroup) MinMsgRate() int64
MinMsgRate returns the smallest message Rate in the SampleGroup
func (*BenchSampleGroup) MsgRateStatistics ¶
func (sg *BenchSampleGroup) MsgRateStatistics() string
MsgRateStatistics prints statistics for the message rates of the BenchSample group (min, average, max and standard deviation)
func (*BenchSampleGroup) StdDevMsgs ¶ added in v0.3.1
func (sg *BenchSampleGroup) StdDevMsgs() float64
StdDevMsgs returns the standard deviation the message rates in the SampleGroup
type BenchmarkResults ¶
type BenchmarkResults struct {
BenchSample
Name string
RunID string
BenchType string
SampleGroup *BenchSampleGroup
SamplesChannel chan *BenchSample
}
BenchmarkResults to hold the various Samples organized by publishers and subscribers
func NewBenchmark ¶
func NewBenchmark(name string, benchType string, clientCount int) *BenchmarkResults
NewBenchmark initializes a Benchmark. After creating a bench call AddSample. When done collecting samples, call Close() to calculate aggregates.
func (*BenchmarkResults) AddSample ¶
func (bm *BenchmarkResults) AddSample(s *BenchSample)
AddSample adds a BenchSample to the BenchmarkResults
func (*BenchmarkResults) CSV ¶
func (bm *BenchmarkResults) CSV() string
CSV generates a csv report of all the samples collected
func (*BenchmarkResults) Close ¶
func (bm *BenchmarkResults) Close()
Close organizes collected Samples and calculates aggregates. After Close(), no more samples can be added.
func (*BenchmarkResults) Prefix ¶
func (bm *BenchmarkResults) Prefix() string
Prefix generates the "P" or "S" prefix for the BenchmarkResults type
func (*BenchmarkResults) Report ¶
func (bm *BenchmarkResults) Report() string
Report returns a human-readable report of the samples taken in the Benchmark