benchmark

package
v0.11.0 Latest Latest
Warning

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

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

README

Replication Benchmark (Kind)

This package benchmarks BanyanDB replication performance across RF=1/2/3 using a Kind-based Kubernetes cluster and the measure module.

Prerequisites

  • Linux with Docker
  • kind, kubectl, and helm in PATH
  • Go toolchain (same as repo)

Run make generate first. Generated protobuf Go files are part of the normal contributor workflow.

Chart Source

By default the benchmark installs the official OCI chart:

oci://registry-1.docker.io/apache/skywalking-banyandb-helm

with chart version 0.5.3. OCI pulls require Helm registry login:

helm registry login registry-1.docker.io

Recommended maintainer path (faster, repeatable) is a local checkout of the official chart repo:

export BANYANDB_BENCH_CHART=/path/to/skywalking-banyandb-helm

You can override the chart version when using OCI:

export BANYANDB_BENCH_CHART_VERSION=0.5.3

Running

From repo root:

export BANYANDB_BENCH_CHART=/path/to/skywalking-banyandb-helm  # optional
./test/integration/replication/benchmark/run.sh

The suite creates a Kind cluster once, builds & loads a local BanyanDB image, then runs RF=1/2/3 sequentially.

Environment Variables

  • BANYANDB_BENCH_CHART - chart ref/path (default: OCI ref)
  • BANYANDB_BENCH_CHART_VERSION - chart version when using OCI (default: 0.5.3)
  • BANYANDB_BENCH_REPORT_DIR - JSON report output dir (default: parent of repo)
  • BENCH_WRITERS - number of write workers (default: 4)
  • BENCH_ENTITIES - number of entities (default: 200)
  • BENCH_POINTS_PER_ENTITY - points per entity (default: 30)
  • BENCH_QUERY_WORKERS - query worker count (default: 4)
  • BENCH_QUERY_ITERATIONS - query iterations (default: 200)
  • BENCH_METRICS_INTERVAL - Prometheus scrape interval (default: 5s)

Outputs

  • Human-readable Ginkgo summary in test output
  • Machine-readable JSON report written to BANYANDB_BENCH_REPORT_DIR (or repo parent dir by default)

Cleanup

The suite deletes the RF namespace and Helm release after each run and deletes the Kind cluster after the suite.

Local Smoke Test

Use small values and a local chart:

export BANYANDB_BENCH_CHART=/path/to/skywalking-banyandb-helm
export BENCH_ENTITIES=20
export BENCH_POINTS_PER_ENTITY=5
export BENCH_QUERY_ITERATIONS=20
./test/integration/replication/benchmark/run.sh

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggregatedSample

type AggregatedSample struct {
	Timestamp   time.Time
	CPUSeconds  float64
	RSSBytes    float64
	CPUNum      float64
	TotalMemory float64
}

AggregatedSample represents one aggregated metrics scrape point.

type AggregatedSeries

type AggregatedSeries struct {
	Samples []AggregatedSample
}

AggregatedSeries stores samples collected over a benchmark phase.

type BenchReport

type BenchReport struct {
	GeneratedAt time.Time  `json:"generated_at"`
	Results     []RFResult `json:"results"`
	Config      Config     `json:"config"`
}

BenchReport is the top-level JSON report artifact for a benchmark run.

type Config

type Config struct {
	ChartRef            string
	ChartVersion        string
	ReportDir           string
	Writers             int
	Entities            int
	PointsPerEntity     int
	QueryWorkers        int
	QueryIterations     int
	MetricsPollInterval time.Duration
}

Config captures benchmark configuration from env vars.

func LoadConfig

func LoadConfig() Config

LoadConfig reads benchmark settings from environment variables.

func (Config) Validate

func (c Config) Validate() error

Validate checks configuration values before benchmark execution.

type PromMetrics

type PromMetrics struct {
	CPUTotalSeconds float64
	RSSBytes        float64
	CPUNum          float64
	TotalMemBytes   float64
}

PromMetrics contains raw counters and gauges scraped from /metrics endpoints.

type RFResult

type RFResult struct {
	ReplicationFactor int            `json:"replication_factor"`
	Write             WriteResult    `json:"write"`
	Read              ReadResult     `json:"read"`
	Resources         ResourceReport `json:"resources"`
}

RFResult stores one replication-factor benchmark result.

type ReadResult

type ReadResult struct {
	Samples  int     `json:"samples"`
	MinMs    float64 `json:"min_ms"`
	MedianMs float64 `json:"median_ms"`
	P95Ms    float64 `json:"p95_ms"`
	P99Ms    float64 `json:"p99_ms"`
	MaxMs    float64 `json:"max_ms"`
}

ReadResult summarizes read latency percentiles.

type ResourcePhase

type ResourcePhase struct {
	Liaison ResourceStats `json:"liaison"`
	Data    ResourceStats `json:"data"`
}

ResourcePhase stores resource summaries for liaison and data roles.

type ResourceReport

type ResourceReport struct {
	WritePhase ResourcePhase `json:"write_phase"`
	ReadPhase  ResourcePhase `json:"read_phase"`
}

ResourceReport contains write/read phase resource usage.

type ResourceStats

type ResourceStats struct {
	PeakRSSBytes   int64   `json:"peak_rss_bytes"`
	PeakRSSPercent float64 `json:"peak_rss_percent"`
	MeanCPUPercent float64 `json:"mean_cpu_percent"`
	PeakCPUPercent float64 `json:"peak_cpu_percent"`
}

ResourceStats contains CPU and RSS summary metrics.

type ResourceStatsSeries

type ResourceStatsSeries struct {
	MeanCPUPercent float64
	PeakCPUPercent float64
	PeakRSSBytes   int64
	PeakRSSPercent float64
}

ResourceStatsSeries summarizes CPU and memory usage over a phase.

type WriteResult

type WriteResult struct {
	TotalPoints   int     `json:"total_points"`
	DurationSec   float64 `json:"duration_sec"`
	ThroughputPps float64 `json:"throughput_points_per_sec"`
}

WriteResult describes write phase throughput and duration.

Jump to

Keyboard shortcuts

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