Documentation
¶
Index ¶
- Constants
- Variables
- func DisplayFinalResults(cfg YCSBConfig, result Result, totalOps []int)
- func DisplayFinalResultsWithMetrics(cfg YCSBConfig, result Result, totalOps []int, metrics *MetricsCollector)
- func RenderHistogram(buckets []HistogramBucket) string
- type HistogramBucket
- type LatencySnapshot
- type MetricsCollector
- func (mc *MetricsCollector) GetErrorBreakdown() (byType map[string]int, byOp map[OpType]int)
- func (mc *MetricsCollector) GetHistogram() []HistogramBucket
- func (mc *MetricsCollector) GetPerOperationStats() map[OpType]OperationStats
- func (mc *MetricsCollector) GetThroughputSeries() []ThroughputPoint
- func (mc *MetricsCollector) RecordOperation(opType OpType, latency time.Duration, err error)
- func (mc *MetricsCollector) RecordThroughput(opsPerSec float64, opType OpType)
- type OpType
- type OperationStats
- type PtermProgressReporter
- func (pr *PtermProgressReporter) GetStats() (completed int64, errors int64, opCounts []int64)
- func (pr *PtermProgressReporter) RecordOp(opType OpType, latency time.Duration, err error)
- func (pr *PtermProgressReporter) Start() error
- func (pr *PtermProgressReporter) Stop()
- func (pr *PtermProgressReporter) UpdateLatencies(p50, p95, p99, p999 float64)
- type Result
- type ThroughputPoint
- type ThroughputSummary
- type WorkloadSpec
- type YCSBConfig
Constants ¶
const StreamingThreshold = 4 * 1024 * 1024 // 4MB
StreamingThreshold defines the size threshold (4MB) above which streaming is automatically used
Variables ¶
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 ¶
HistogramBucket represents a latency histogram bucket
type LatencySnapshot ¶
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 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 ¶
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
}