Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Benchmark Quick Reference Guide

Last Updated: 2025-10-08

Quick commands for running all benchmarks in the distributed benchmarking suite.


Prerequisites

# Start all Docker services
docker-compose -f docker/docker-compose.test.yml up -d

# Verify services are healthy
curl http://localhost:8080/health  # Orchestration
curl http://localhost:8081/health  # Rust Worker
curl http://localhost:8082/health  # Ruby Worker (optional)

# Set database URL (for SQL benchmarks)
export DATABASE_URL="postgresql://tasker:tasker@localhost:5432/tasker_rust_test"

Individual Benchmarks

✅ Implemented Benchmarks

# 1. API Task Creation (COMPLETE - 17.7-20.8ms)
cargo bench --package tasker-client --features benchmarks

# 2. SQL Function Performance (COMPLETE - 380µs-2.93ms)
DATABASE_URL="postgresql://tasker:tasker@localhost:5432/tasker_rust_test" \
cargo bench --package tasker-shared --features benchmarks sql_functions

🚧 Placeholder Benchmarks

# 3. Event Propagation (placeholder)
cargo bench --package tasker-shared --features benchmarks event_propagation

# 4. Worker Execution (placeholder)
cargo bench --package tasker-worker --features benchmarks worker_execution

# 5. Handler Overhead (placeholder)
cargo bench --package tasker-worker --features benchmarks handler_overhead

# 6. Step Enqueueing (placeholder)
cargo bench --package tasker-orchestration --features benchmarks step_enqueueing

# 7. End-to-End Latency (placeholder)
cargo bench --test e2e_latency

Run All Benchmarks

# Run ALL benchmarks (implemented + placeholders)
cargo bench --all-features

# Run only SQL benchmarks
cargo bench --package tasker-shared --features benchmarks

# Run only worker benchmarks
cargo bench --package tasker-worker --features benchmarks

Benchmark Categories

CategoryPackageBenchmark NameStatusRun Command
APItasker-clienttask_initialization✅ Completecargo bench -p tasker-client --features benchmarks
SQLtasker-sharedsql_functions✅ CompleteDATABASE_URL=... cargo bench -p tasker-shared --features benchmarks sql_functions
Eventstasker-sharedevent_propagation🚧 Placeholdercargo bench -p tasker-shared --features benchmarks event_propagation
Workertasker-workerworker_execution🚧 Placeholdercargo bench -p tasker-worker --features benchmarks worker_execution
Workertasker-workerhandler_overhead🚧 Placeholdercargo bench -p tasker-worker --features benchmarks handler_overhead
Orchestrationtasker-orchestrationstep_enqueueing🚧 Placeholdercargo bench -p tasker-orchestration --features benchmarks
E2Etestse2e_latency🚧 Placeholdercargo bench --test e2e_latency

Benchmark Output Locations

# Criterion HTML reports
open target/criterion/report/index.html

# Individual benchmark data
ls target/criterion/

# Proposed: Structured logs (not yet implemented)
# tmp/benchmarks/YYYY-MM-DD-benchmark-name.log

Common Options

# Save baseline for comparison
cargo bench --features benchmarks -- --save-baseline main

# Compare to baseline
cargo bench --features benchmarks -- --baseline main

# Verbose output
cargo bench --features benchmarks -- --verbose

# Run specific benchmark
cargo bench --package tasker-client --features benchmarks task_creation_api

# Skip health checks (CI mode)
TASKER_TEST_SKIP_HEALTH_CHECK=true cargo bench --features benchmarks

Troubleshooting

“Services must be running”

# Start Docker services
docker-compose -f docker/docker-compose.test.yml up -d

# Check service health
curl http://localhost:8080/health

“DATABASE_URL must be set”

export DATABASE_URL="postgresql://tasker:tasker@localhost:5432/tasker_rust_test"

“Task template not found”

# Ensure worker services are running (they register templates)
docker-compose -f docker/docker-compose.test.yml ps

# Check registered templates
curl -s http://localhost:8080/v1/handlers | jq

Compilation errors

# Clean and rebuild
cargo clean
cargo build --all-features

Performance Targets

BenchmarkMetricTargetCurrentStatus
Task Init (linear)mean< 50ms17.7ms✅ 3x better
Task Init (diamond)mean< 75ms20.8ms✅ 3.6x better
SQL Task Discoverymean< 3ms1.75-2.93ms✅ Pass
SQL Step Readinessmean< 1ms440-603µs✅ Pass
Worker Total Overheadmean< 60msTBD🚧
Event Notify (p95)p95< 10msTBD🚧
Step Enqueue (3 steps)mean< 50msTBD🚧
E2E Complete (3 steps)p99< 500msTBD🚧

Documentation