go-nats: github.com/nats-io/go-nats/bench Index | Files

package bench

import "github.com/nats-io/go-nats/bench"

Index

Package Files

bench.go

func HumanBytes Uses

func HumanBytes(bytes float64, si bool) string

HumanBytes formats bytes as a human readable string

func MsgsPerClient Uses

func MsgsPerClient(numMsgs, numClients int) []int

MsgsPerClient divides the number of messages by the number of clients and tries to distribute them as evenly as possible

type Benchmark Uses

type Benchmark struct {
    Sample
    Name  string
    RunID string
    Pubs  *SampleGroup
    Subs  *SampleGroup
    // contains filtered or unexported fields
}

Benchmark to hold the various Samples organized by publishers and subscribers

func NewBenchmark Uses

func NewBenchmark(name string, subCnt, pubCnt int) *Benchmark

NewBenchmark initializes a Benchmark. After creating a bench call AddSubSample/AddPubSample. When done collecting samples, call EndBenchmark

func (*Benchmark) AddPubSample Uses

func (bm *Benchmark) AddPubSample(s *Sample)

AddPubSample to the benchmark

func (*Benchmark) AddSubSample Uses

func (bm *Benchmark) AddSubSample(s *Sample)

AddSubSample to the benchmark

func (*Benchmark) CSV Uses

func (bm *Benchmark) CSV() string

CSV generates a csv report of all the samples collected

func (*Benchmark) Close Uses

func (bm *Benchmark) Close()

Close organizes collected Samples and calculates aggregates. After Close(), no more samples can be added.

func (*Benchmark) Report Uses

func (bm *Benchmark) Report() string

Report returns a human readable report of the samples taken in the Benchmark

type Sample Uses

type Sample struct {
    JobMsgCnt int
    MsgCnt    uint64
    MsgBytes  uint64
    IOBytes   uint64
    Start     time.Time
    End       time.Time
}

A Sample for a particular client

func NewSample Uses

func NewSample(jobCount int, msgSize int, start, end time.Time, nc *nats.Conn) *Sample

NewSample creates a new Sample initialized to the provided values. The nats.Conn information captured

func (*Sample) Duration Uses

func (s *Sample) Duration() time.Duration

Duration that the sample was active

func (*Sample) Rate Uses

func (s *Sample) Rate() int64

Rate of meessages in the job per second

func (*Sample) Seconds Uses

func (s *Sample) Seconds() float64

Seconds that the sample or samples were active

func (*Sample) String Uses

func (s *Sample) String() string

func (*Sample) Throughput Uses

func (s *Sample) Throughput() float64

Throughput of bytes per second

type SampleGroup Uses

type SampleGroup struct {
    Sample
    Samples []*Sample
}

SampleGroup for a number of samples, the group is a Sample itself agregating the values the Samples

func NewSampleGroup Uses

func NewSampleGroup() *SampleGroup

NewSampleGroup initializer

func (*SampleGroup) AddSample Uses

func (sg *SampleGroup) AddSample(e *Sample)

AddSample adds a Sample to the SampleGroup. After adding a Sample it shouldn't be modified.

func (*SampleGroup) AvgRate Uses

func (sg *SampleGroup) AvgRate() int64

AvgRate returns the average of all the message rates in the SampleGroup

func (*SampleGroup) HasSamples Uses

func (sg *SampleGroup) HasSamples() bool

HasSamples returns true if the group has samples

func (*SampleGroup) MaxRate Uses

func (sg *SampleGroup) MaxRate() int64

MaxRate returns the largest message rate in the SampleGroup

func (*SampleGroup) MinRate Uses

func (sg *SampleGroup) MinRate() int64

MinRate returns the smallest message rate in the SampleGroup

func (*SampleGroup) Statistics Uses

func (sg *SampleGroup) Statistics() string

Statistics information of the sample group (min, average, max and standard deviation)

func (*SampleGroup) StdDev Uses

func (sg *SampleGroup) StdDev() float64

StdDev returns the standard deviation the message rates in the SampleGroup

Package bench imports 9 packages (graph) and is imported by 4 packages. Updated 2019-06-11. Refresh now. Tools for package owners.