Skip to content

feat: API Benchmark Suite — autocannon-based performance testing (#30)#44

Open
malsony wants to merge 2 commits into
SecureBananaLabs:mainfrom
malsony:fix/benchmark-suite
Open

feat: API Benchmark Suite — autocannon-based performance testing (#30)#44
malsony wants to merge 2 commits into
SecureBananaLabs:mainfrom
malsony:fix/benchmark-suite

Conversation

@malsony
Copy link
Copy Markdown

@malsony malsony commented May 17, 2026

Summary

Adds a comprehensive API benchmark suite using autocannon.

What's included

  • benchmarks/run.mjs — Full benchmark runner that:

    • Auto-starts the API server if not already running
    • Tests 22 endpoints (health, auth, users, jobs, proposals, messages, reviews, payments, search, uploads, notifications, admin metrics)
    • Generates per-endpoint JSON results + aggregate JSON + markdown summary
    • Validates p99 latency against threshold limits
  • benchmarks/thresholds.json — P99 latency thresholds (ms) for each endpoint

  • benchmarks/.env.benchmark — Configurable env vars (base URL, duration, connections, pipelining, JWT secret)

  • npm scripts:

    • npm run benchmark — Full benchmark (10s per endpoint, 10 connections)
    • npm run benchmark:smoke — Smoke test (3s per endpoint, 2 connections)
  • .gitignore — Excludes benchmark results JSON/MD files, keeps .gitkeep

Dependencies

  • autocannon@^8.0.0 — HTTP benchmarking
  • jsonwebtoken@^9.0.2 — JWT generation for auth-protected routes

Closes #30

- Add benchmarks/run.mjs — full API benchmark runner covering 22 endpoints
- Add benchmarks/thresholds.json — p99 latency thresholds per endpoint
- Add benchmarks/.env.benchmark — benchmark environment config template
- Add npm scripts: benchmark (full), benchmark:smoke (low concurrency)
- Add autocannon + jsonwebtoken as devDependencies
- Update .gitignore to exclude benchmark results while keeping .gitkeep
- Move jsonwebtoken to devDependencies in apps/api

Closes SecureBananaLabs#30
github-actions Bot added a commit that referenced this pull request May 17, 2026
autocannon v8 does not expose p95 nor TTFB. Switch to p97_5
percentile and drop the TTFB column entirely instead of faking it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Benchmark APIs with p50, p95, p99 latency, RPS, error rate and TTFB

1 participant