bench

package
v0.24.1 Latest Latest
Warning

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

Go to latest
Published: May 9, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package bench contains benchmarking utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Size

type Size int
const (
	B  Size = 1
	KB Size = 1000
	MB Size = 1000 * KB
	GB Size = 1000 * MB
	TB Size = 1000 * GB
)

func (Size) Bytes

func (s Size) Bytes() int

func (Size) String

func (s Size) String() string

type StoreConfig

type StoreConfig struct {
	NumKeys      int           // The number of keys to sample from.
	ValueSize    Size          // The size of values written to keys.
	ReadFraction float32       // The fraction of operations that are reads.
	Duration     time.Duration // The duration of the benchmark.
	Logger       *slog.Logger  // A logger.
	Parallelism  int           // The number of parallel store operations.
}

StoreConfig configures the benchmark run by BenchStore.

type StoreStats

type StoreStats struct {
	Throughput       float64       // Number of ops/second (reads and writes).
	MeanReadLatency  time.Duration // Mean read latency.
	MeanWriteLatency time.Duration // Mean write latency.
}

StoreStats contains statistics about a store benchmark.

func BenchStore

func BenchStore(ctx context.Context, store store.Store, config StoreConfig) (StoreStats, error)

BenchStore benchmarks the provided store by repeatedly performing reads and writes against a set of keys sampled uniformly at random.

Jump to

Keyboard shortcuts

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