ycsb

package
v1.11.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const StreamingThreshold = 4 * 1024 * 1024 // 4MB

StreamingThreshold defines the size threshold (4MB) above which streaming is automatically used

Variables

View Source
var WorkloadPresets = map[string]WorkloadSpec{
	"A": {Weights: [OpNum]float64{0.5, 0.5}},
	"B": {Weights: [OpNum]float64{0.95, 0.05}},
	"C": {Weights: [OpNum]float64{1.0, 0}},
}

Functions

func DisplayFinalResults

func DisplayFinalResults(cfg YCSBConfig, result Result, totalOps []int)

DisplayFinalResults displays the final benchmark results using pterm tables

func DisplayFinalResultsWithMetrics

func DisplayFinalResultsWithMetrics(cfg YCSBConfig, result Result, totalOps []int, metrics *MetricsCollector)

DisplayFinalResultsWithMetrics displays the final benchmark results with enhanced metrics

func RenderHistogram

func RenderHistogram(buckets []HistogramBucket) string

RenderHistogram creates an ASCII histogram visualization

Types

type HistogramBucket

type HistogramBucket struct {
	Min   time.Duration
	Max   time.Duration
	Count int
}

HistogramBucket represents a latency histogram bucket

type LatencySnapshot

type LatencySnapshot struct {
	P50  float64
	P95  float64
	P99  float64
	P999 float64
}

type MetricsCollector

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

MetricsCollector collects detailed metrics during benchmark execution

func NewMetricsCollector

func NewMetricsCollector() *MetricsCollector

NewMetricsCollector creates a new metrics collector

func (*MetricsCollector) GetErrorBreakdown

func (mc *MetricsCollector) GetErrorBreakdown() (byType map[string]int, byOp map[OpType]int)

GetErrorBreakdown returns detailed error categorization

func (*MetricsCollector) GetHistogram

func (mc *MetricsCollector) GetHistogram() []HistogramBucket

GetHistogram returns the latency histogram

func (*MetricsCollector) GetPerOperationStats

func (mc *MetricsCollector) GetPerOperationStats() map[OpType]OperationStats

GetPerOperationStats returns statistics for each operation type

func (*MetricsCollector) GetThroughputSeries

func (mc *MetricsCollector) GetThroughputSeries() []ThroughputPoint

GetThroughputSeries returns the throughput time series

func (*MetricsCollector) RecordOperation

func (mc *MetricsCollector) RecordOperation(opType OpType, latency time.Duration, err error)

RecordOperation records a single operation's metrics

func (*MetricsCollector) RecordThroughput

func (mc *MetricsCollector) RecordThroughput(opsPerSec float64, opType OpType)

RecordThroughput records throughput at current time

type OpType

type OpType int
const (
	OpRead OpType = iota
	OpUpdate
	OpNum
)

type OperationStats

type OperationStats struct {
	Count       int
	ErrorCount  int
	MinLatency  time.Duration
	MaxLatency  time.Duration
	AvgLatency  time.Duration
	P50Latency  time.Duration
	P95Latency  time.Duration
	P99Latency  time.Duration
	P999Latency time.Duration
}

OperationStats holds statistics for a single operation type

type PtermProgressReporter

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

PtermProgressReporter handles real-time progress reporting using pterm

func NewPtermProgressReporter

func NewPtermProgressReporter(totalOps int) *PtermProgressReporter

NewPtermProgressReporter creates a new pterm-based progress reporter

func (*PtermProgressReporter) GetStats

func (pr *PtermProgressReporter) GetStats() (completed int64, errors int64, opCounts []int64)

GetStats returns final statistics

func (*PtermProgressReporter) RecordOp

func (pr *PtermProgressReporter) RecordOp(opType OpType, latency time.Duration, err error)

RecordOp records a completed operation

func (*PtermProgressReporter) Start

func (pr *PtermProgressReporter) Start() error

Start begins the progress reporting

func (*PtermProgressReporter) Stop

func (pr *PtermProgressReporter) Stop()

Stop stops the progress reporting

func (*PtermProgressReporter) UpdateLatencies

func (pr *PtermProgressReporter) UpdateLatencies(p50, p95, p99, p999 float64)

UpdateLatencies updates the latency snapshot

type Result

type Result struct {
	Ops       int
	Duration  time.Duration
	Errors    int
	Latencies []time.Duration // All operation latencies
}

func RunYCSB

func RunYCSB(cfg YCSBConfig) (Result, error)

func RunYCSBWithContext

func RunYCSBWithContext(ctx context.Context, cfg YCSBConfig) (Result, error)

type ThroughputPoint

type ThroughputPoint struct {
	Time      time.Duration // Time since start
	OpsPerSec float64
	OpType    OpType
}

ThroughputPoint represents throughput at a point in time

type ThroughputSummary

type ThroughputSummary struct {
	MinThroughput    float64
	MaxThroughput    float64
	AvgThroughput    float64
	StdDevThroughput float64
	ThroughputTrend  string // "increasing", "decreasing", "stable"
}

ThroughputSummary provides summary of throughput over time

func AnalyzeThroughput

func AnalyzeThroughput(series []ThroughputPoint) ThroughputSummary

AnalyzeThroughput analyzes throughput time series

type WorkloadSpec

type WorkloadSpec struct {
	Weights [OpNum]float64 // Fraction for each op type
}

WorkloadSpec defines the operation mix for a workload.

func ParseWorkload

func ParseWorkload(s string) (WorkloadSpec, error)

type YCSBConfig

type YCSBConfig struct {
	Addr               string        // Address of the cache service (host:port or comma-separated)
	ConnMode           string        // Connection mode: auto, simple, or cluster
	TopologyRefresh    time.Duration // Topology refresh interval (cluster mode only)
	ConnectionPoolSize int           // Number of connections per address (default: 4)
	NumKeys            int           // Number of unique keys to use in the benchmark
	ValueSize          int           // Size of each value in bytes
	NumOps             int           // Total number of operations to perform
	Concurrency        int           // Number of concurrent workers
	Workload           string        // Workload type or custom mix (e.g. "A", "B", "read=70,update=30")
	Seed               int64         // Seed for random number generation (for reproducibility)
	NoProgress         bool          // Disable progress output during benchmark
	ForceStreaming     bool          // Force streaming for all operations regardless of size
}

Jump to

Keyboard shortcuts

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