benchmark

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2024 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultMessageSize    = 0
	DefaultBatchSize      = 1
	DefaultConcurrency    = 0
	DefaultDuration       = 1 * time.Minute
	DefaultReportInterval = 3 * time.Second
)

Variables

This section is empty.

Functions

func MustEncode added in v0.9.0

func MustEncode(enc ReportEncoder, trs TargetReports) string

func NewMessage

func NewMessage(size uint) []byte

Types

type AppendMetrics

type AppendMetrics struct {
	// contains filtered or unexported fields
}

type AppendReport added in v0.8.0

type AppendReport struct {
	RequestsPerSecond float64 `json:"requestsPerSecond"`
	BytesPerSecond    float64 `json:"bytesPerSecond"`
	Duration          float64 `json:"duration"`
}

func NewAppendReportFromMetrics added in v0.8.0

func NewAppendReportFromMetrics(metrics AppendMetrics, interval time.Duration) AppendReport

type Benchmark

type Benchmark struct {
	// contains filtered or unexported fields
}

func New

func New(opts ...Option) (bm *Benchmark, err error)

New creates a new Benchmark and returns it. Users must call Close to release resources if it returns successfully.

func (*Benchmark) Close

func (bm *Benchmark) Close() error

Close releases resources acquired by Benchmark and Loader.

func (*Benchmark) Run

func (bm *Benchmark) Run() error

Run starts Loaders and metric reporter. It blocks until the loaders are finished.

type EndToEndReport added in v0.8.0

type EndToEndReport struct {
	Latency float64 `json:"latency"`
}

type JsonEncoder added in v0.9.0

type JsonEncoder struct{}

func (JsonEncoder) Encode added in v0.9.0

func (je JsonEncoder) Encode(trs TargetReports) ([]byte, error)

type Loader

type Loader struct {
	// contains filtered or unexported fields
}

func NewLoader

func NewLoader(cfg loaderConfig) (loader *Loader, err error)

func (*Loader) Close

func (loader *Loader) Close() error

func (*Loader) Run

func (loader *Loader) Run(ctx context.Context) (err error)

Run starts goroutines that append log entries and subscribe to them.

type LoaderMetrics

type LoaderMetrics struct {
	// contains filtered or unexported fields
}

func (*LoaderMetrics) Flush

func (lm *LoaderMetrics) Flush() TargetReport

func (*LoaderMetrics) ReportAppendMetrics

func (lm *LoaderMetrics) ReportAppendMetrics(m AppendMetrics) bool

func (*LoaderMetrics) ReportSubscribeMetrics

func (lm *LoaderMetrics) ReportSubscribeMetrics(m SubscribeMetrics) bool

func (*LoaderMetrics) Reset

func (lm *LoaderMetrics) Reset(now time.Time)

type Metrics

type Metrics struct {
	// contains filtered or unexported fields
}

func (Metrics) Flush added in v0.9.0

func (m Metrics) Flush() TargetReports

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithClusterID

func WithClusterID(cid types.ClusterID) Option

func WithDuration

func WithDuration(duration time.Duration) Option

func WithMetadataRepository

func WithMetadataRepository(addrs []string) Option

func WithReportEncoder added in v0.9.0

func WithReportEncoder(enc ReportEncoder) Option

func WithReportInterval

func WithReportInterval(reportInterval time.Duration) Option

func WithSingleConnPerTarget added in v0.15.0

func WithSingleConnPerTarget() Option

func WithTargets

func WithTargets(targets ...Target) Option

type Report added in v0.8.0

type Report struct {
	AppendReport    `json:"append"`
	SubscribeReport `json:"subscribe"`
	EndToEndReport  `json:"endToEnd"`
}

type ReportEncoder added in v0.9.0

type ReportEncoder interface {
	Encode(trs TargetReports) ([]byte, error)
}

type StringEncoder added in v0.9.0

type StringEncoder struct{}

func (StringEncoder) Encode added in v0.9.0

func (se StringEncoder) Encode(trs TargetReports) ([]byte, error)

type SubscribeMetrics

type SubscribeMetrics struct {
	// contains filtered or unexported fields
}

type SubscribeReport added in v0.8.0

type SubscribeReport struct {
	LogsPerSecond  float64 `json:"logsPerSecond"`
	BytesPerSecond float64 `json:"bytesPerSecond"`
}

func NewSubscribeReportFromMetrics added in v0.8.0

func NewSubscribeReportFromMetrics(metrics SubscribeMetrics, interval time.Duration) SubscribeReport

type Target

type Target struct {
	TopicID          types.TopicID     `json:"topicId"`
	LogStreamID      types.LogStreamID `json:"logStreamId"`
	MessageSize      uint
	BatchSize        uint
	AppendersCount   uint
	SubscribersCount uint
	PipelineSize     int
}

func (Target) String added in v0.8.0

func (tgt Target) String() string

func (Target) Valid

func (tgt Target) Valid() error

type TargetReport added in v0.9.0

type TargetReport struct {
	Target string `json:"target"`
	Recent Report `json:"recent"`
	Total  Report `json:"total"`
}

type TargetReports added in v0.9.0

type TargetReports struct {
	Reports []TargetReport `json:"reports"`
}

Jump to

Keyboard shortcuts

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