bench

package
v0.0.0-...-6206b6d Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2021 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Benchmark

type Benchmark struct {
	cfg.Bconfig
	*History
	// contains filtered or unexported fields
}

Benchmark is benchmarking tool that generates workload and collects operation history and latency

func NewBenchmark

func NewBenchmark(preferredId idservice.ID, algorithm string) *Benchmark

NewBenchmark returns new Benchmark object given implementation of DB interface

func (*Benchmark) Load

func (b *Benchmark) Load()

Load will create all K keys to DB

func (*Benchmark) Run

func (b *Benchmark) Run()

Run starts the main logic of benchmarking

type DB

type DB interface {
	Read(key int) ([]byte, error)
	Write(key int, value []byte) error
}

DB is general interface implemented by client to call client library

type History

type History struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

History client operation history mapped by key

func NewHistory

func NewHistory() *History

NewHistory creates a History map

func (*History) Add

func (h *History) Add(key int, input, output db.Value, start, end int64)

Add puts an operation in History

func (*History) AddOperation

func (h *History) AddOperation(key int, o *operation)

AddOperation adds the operation

func (*History) Linearizable

func (h *History) Linearizable() int

Linearizable concurrently checks if each partition of the history is linearizable and returns the total number of anomaly reads

func (*History) ReadFile

func (h *History) ReadFile(path string) error

ReadFile reads csv log file and create operations in history

func (*History) WriteFile

func (h *History) WriteFile(path string) error

WriteFile writes entire operation history into file

type Limiter

type Limiter struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Limiter limits operation rate when used with Wait function

func NewLimiter

func NewLimiter(rate int) *Limiter

NewLimiter creates a new rate limiter, where rate is operations per second

func (*Limiter) Wait

func (l *Limiter) Wait()

Wait blocks for the limit

type RWClient

type RWClient struct {
	client.Client
}

db implements DB interface for benchmarking

func (*RWClient) Read

func (d *RWClient) Read(k int) ([]byte, error)

func (*RWClient) Write

func (d *RWClient) Write(k int, v []byte) error

type Stat

type Stat struct {
	Data   []float64
	Size   int
	Mean   float64
	Min    float64
	Max    float64
	Median float64
	P95    float64
	P99    float64
	P999   float64
}

Stat stores the statistics data for benchmarking results

func Statistic

func Statistic(latency []time.Duration) Stat

Statistic function creates Stat object from raw latency data

func (Stat) String

func (s Stat) String() string

func (Stat) WriteFile

func (s Stat) WriteFile(path string) error

WriteFile writes stat to new file in path

Jump to

Keyboard shortcuts

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