// Benchmark HBF performance using Apache Bench (ab). Measures static asset serving, versioned filesystem operations, and QuickJS runtime routes. Maintains historical data for performance tracking over time.
| name | benchmark |
| description | Benchmark HBF performance using Apache Bench (ab). Measures static asset serving, versioned filesystem operations, and QuickJS runtime routes. Maintains historical data for performance tracking over time. |
This skill provides reproducible performance benchmarking for HBF using Apache Bench (ab). It tests three main categories of operations and maintains historical data for comparison over time.
Tests serving static files from the embedded SQLite database via the latest_files view.
Endpoints:
/static/style.css - Small CSS file/static/favicon.ico - Empty fileTests endpoints that require QuickJS execution and JSON serialization.
Endpoints:
/hello - Simple JSON response/user/42 - Parameterized route with path parsing/echo - Echo endpoint reflecting request detailsDefault test parameters (configurable):
These defaults provide faster test runs while maintaining statistical validity.
Results are stored in /workspaces/hbf/.benchmark/results.db using SQLite:
CREATE TABLE IF NOT EXISTS benchmark_runs (
run_id INTEGER PRIMARY KEY AUTOINCREMENT,
timestamp TEXT NOT NULL,
git_commit TEXT,
git_branch TEXT,
build_mode TEXT,
notes TEXT
);
CREATE TABLE IF NOT EXISTS benchmark_results (
result_id INTEGER PRIMARY KEY AUTOINCREMENT,
run_id INTEGER NOT NULL,
category TEXT NOT NULL,
endpoint TEXT NOT NULL,
requests INTEGER NOT NULL,
concurrency INTEGER NOT NULL,
time_taken REAL NOT NULL,
requests_per_sec REAL NOT NULL,
time_per_request REAL NOT NULL,
transfer_rate REAL NOT NULL,
failed_requests INTEGER NOT NULL,
FOREIGN KEY (run_id) REFERENCES benchmark_runs(run_id)
);
When you invoke this skill, it will:
# Default: 1k requests, concurrency 10
./benchmark.sh
# Custom parameters
./benchmark.sh --requests 50000 --concurrency 50
# With build mode specification
./benchmark.sh --build-mode opt --requests 10000
# Add notes for this run
./benchmark.sh --notes "After QuickJS optimization"
# Show recent benchmark runs
./show_results.sh
# Compare specific runs
./show_results.sh --compare run1 run2
# Show trend for specific endpoint
./show_results.sh --trend /hello
The main benchmark.sh script performs:
Environment setup
Build binary
bazel build //:hbf --compilation_mode=optStart server
--port 5309Run benchmarks
Parse results
Generate report
Cleanup
The skill generates a markdown-formatted report:
# HBF Benchmark Results
**Run ID:** 42
**Timestamp:** 2025-01-15 10:30:00
**Commit:** abc1234
**Branch:** main
**Build Mode:** opt
## Summary
| Category | Endpoint | Req/sec | Avg Time (ms) | Failed |
|----------|----------|---------|---------------|--------|
| Static | /static/style.css | 45,230 | 0.22 | 0 |
| Runtime | /hello | 38,500 | 0.26 | 0 |
| Runtime | /user/42 | 37,800 | 0.26 | 0 |
| FS Write | PUT /__dev/api/file | 8,500 | 1.18 | 0 |
## Comparison with Previous Run
| Endpoint | Previous | Current | Change |
|----------|----------|---------|--------|
| /hello | 38,200 | 38,500 | +0.8% 📈 |
| /static/style.css | 44,800 | 45,230 | +1.0% 📈 |
## Recommendations
✅ All endpoints performing within expected ranges
⚠️ Consider investigating if any regressions > 5%
This skill includes:
SKILL.md (this file) - Skill documentationbenchmark.sh - Main benchmark runner scriptshow_results.sh - Historical results viewerlib/db.sh - Database operations helperlib/server.sh - Server lifecycle managementlib/parser.sh - Apache Bench output parserab) installed (included in apache2-utils)sqlite3)For reproducible benchmarks:
--compilation_mode=opt for release builds--notes to document changes between runs# Initial baseline
./benchmark.sh --notes "Baseline before optimization"
# Make code changes...
# (edit versioned filesystem code)
# Run new benchmark
./benchmark.sh --notes "After index optimization"
# Compare results
./show_results.sh --compare $(sqlite3 .benchmark/results.db "SELECT run_id FROM benchmark_runs ORDER BY run_id DESC LIMIT 2")
Typical performance on modern hardware (2020+ CPU):
Lower performance may indicate:
--compilation_mode=opt)Potential improvements: