This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
Warp is a high-performance S3 benchmarking tool for testing object storage systems. It supports multiple benchmark types (GET, PUT, DELETE, LIST, STAT, etc.) and can run in distributed mode with multiple clients coordinating through a server.
# Build the binary
go build
# Run the binary
./warp [command] [options]# Run all tests with race detection
go test -v -race ./...
# Run tests for a specific package
go test -v ./pkg/bench
go test -v ./pkg/aggregate# Run golangci-lint (requires installation)
golangci-lint run --timeout=5m --config ./.golangci.yml
# Run go vet
go vet ./...
# Check formatting
gofmt -d .
# Format code
gofmt -w .cli/ - Command-line interface layer
- Each benchmark type has its own file (get.go, put.go, delete.go, etc.)
benchmark.go- Main benchmark execution logic (runBench,runServerBenchmark,runClientBenchmark)benchserver.go/benchclient.go- Distributed benchmarking coordinationclient.go- S3 client creation and configurationflags.go- Common flag definitionsanalyze.go- Post-benchmark analysisui.go- Terminal UI using bubbletea
pkg/bench/ - Benchmark implementations
benchmark.go- CoreBenchmarkinterface withPrepare(),Start(),Cleanup()methodsCommonstruct contains shared configuration (bucket, concurrency, clients, etc.)- Each operation type implements the Benchmark interface (get.go, put.go, mixed.go, etc.)
ops.go- Reusable operation functions (upload, download, delete operations)collector.go- Real-time operation statistics collection
pkg/aggregate/ - Data aggregation and analysis
aggregate.go- Aggregates raw operation data into statisticsthroughput.go- Throughput calculations and statisticsrequests.go- Per-request statistics (latency, TTFB, percentiles)compare.go- Comparison between benchmark runslive.go- Live statistics updates during benchmark runs
pkg/generator/ - Test data generation
- Random data generation for benchmark objects
- Supports fixed size, random sizes, and bucketed sizes
Benchmark Execution Flow:
- CLI parses flags and creates benchmark instance
Prepare()- Creates buckets, uploads initial objects if neededStart()- Runs concurrent operations until duration expires or autoterm triggers- Operations recorded to
Collectorwhich writes to compressed CSV Cleanup()- Removes test data (unless--keep-dataor--noclear)- Analysis runs on recorded data, outputs statistics
Distributed Benchmarking:
- Server mode: Coordinates multiple clients, merges their results
- Client mode: Runs
warp client [address]to listen for benchmark commands - Server sends benchmark configuration to all clients
- Clients execute benchmarks simultaneously
- Results collected and merged by server
Operation Collection:
- Each operation creates an
Operationstruct with timing, size, endpoint, error info - Sent to
Collectorwhich batches and compresses to.csv.zstfiles - Format: CSV with fields like op, time, duration, size, endpoint, error, TTFB
main.go- Entry point, delegates tocli.Main()cli/cli.go- Command registration (lines 89-104 list all benchmark commands)pkg/bench/benchmark.go- Core Benchmark interface definitioncli/benchmark.go:108-runBench()is the main benchmark runner
- Create new file in
pkg/bench/implementing theBenchmarkinterface - Add corresponding command file in
cli/ - Register command in
cli/cli.goinit function - Follow existing patterns (see
get.go,put.goas examples)
Warp is designed to test any S3-compatible storage. Connection configured via:
- Flags:
--host,--access-key,--secret-key,--tls,--region - Environment:
WARP_HOST,WARP_ACCESS_KEY,WARP_SECRET_KEY,WARP_TLS,WARP_REGION
Benchmarks can be configured via YAML files in yml-samples/. Run with:
warp run <file.yml>Variables can be injected: warp run file.yml -var VarName=Value
Benchmark data saved to warp-operation-yyyy-mm-dd[hhmmss]-xxxx.csv.zst:
- Zstandard compressed CSV
- Can be analyzed with
warp analyze <file> - Can be compared with
warp cmp <before> <after> - Can be merged from multiple clients with
warp merge <file1> <file2>...
--concurrent Nsets number of parallel operation threads- Each thread typically has its own prefix to avoid conflicts
- Operations use context cancellation for clean shutdown
- Client connections pooled via
c.Client()function
When --autoterm enabled:
- Continuously samples throughput into 25 time blocks
- Checks if last 7 blocks are within
--autoterm.pctthreshold (default 7.5%) - Must maintain stability for
--autoterm.dur(default 15s) - Prevents premature termination during warmup or unstable periods
Be careful with 64-bit atomic operations - use atomic.AddUint64 with proper alignment (see commit 042a9fc for context).
The project supports HTTP/2 and Kernel TLS (kTLS) for improved performance on Linux. See cli/client_ktls.go and cli/client_transport.go.
Real-time metrics can be pushed to InfluxDB v2+ using --influxdb flag. Connection string format: <schema>://<token>@<hostname>:<port>/<bucket>/<org>?<tag=value>