Skip to content

feat: add API benchmark suite with autocannon#54

Open
capa8795-design wants to merge 1 commit into
SecureBananaLabs:mainfrom
capa8795-design:bounty-30
Open

feat: add API benchmark suite with autocannon#54
capa8795-design wants to merge 1 commit into
SecureBananaLabs:mainfrom
capa8795-design:bounty-30

Conversation

@capa8795-design
Copy link
Copy Markdown

Summary

Add a complete API benchmark suite using autocannon. Covers all 21 API endpoints with latency (p50/p95/p99), RPS, and error rate metrics. Includes a CI smoke benchmark that gates on configurable thresholds.

Changes

New files

  • benchmarks/ — autocannon benchmark suite (benchmark.js, thresholds.json, README, .env.benchmark)
  • .github/workflows/benchmark.yml — CI smoke benchmark on PR

Modified files

  • package.json — added pm run benchmark\ script + autocannon devDependency
  • apps/api/src/middleware/rateLimit.js — auto-disabled when BENCHMARK=1
  • .gitignore — allow tracking .env.benchmark

Benchmark Results

Benchmark Summary

Date: 2026-05-17T10:24:07.618Z
Tool: autocannon (10 connections, 10s duration)
Target: http://localhost:4001

Per-Endpoint Results

Endpoint Method p50 p95 p99 Avg RPS Errors
GET /health вњ… GET 2.00 ms 4.00 ms 5.00 ms 3В 408 0
POST /api/auth/register вњ… POST 3.00 ms 5.00 ms 6.00 ms 2В 939 0
POST /api/auth/login вњ… POST 2.00 ms 5.00 ms 6.00 ms 3В 026 0
POST /api/auth/refresh вњ… POST 2.00 ms 7.00 ms 11.00 ms 3В 190 0
GET /api/auth/oauth/google/callback вњ… GET 2.00 ms 7.00 ms 10.00 ms 3В 203 0
GET /api/users вњ… GET 2.00 ms 7.00 ms 11.00 ms 3В 178 0
POST /api/users вњ… POST 3.00 ms 5.00 ms 6.00 ms 2В 508 0
GET /api/jobs вњ… GET 2.00 ms 7.00 ms 10.00 ms 3В 195 0
POST /api/jobs вњ… POST 3.00 ms 5.00 ms 6.00 ms 2В 480 0
GET /api/proposals вњ… GET 2.00 ms 7.00 ms 10.00 ms 3В 180 0
POST /api/proposals вњ… POST 3.00 ms 5.00 ms 6.00 ms 2В 523 0
POST /api/payments вњ… POST 3.00 ms 5.00 ms 6.00 ms 2В 559 0
GET /api/reviews вњ… GET 2.00 ms 7.00 ms 10.00 ms 3В 181 0
POST /api/reviews вњ… POST 3.00 ms 5.00 ms 6.00 ms 2В 523 0
GET /api/messages вњ… GET 3.00 ms 7.00 ms 10.00 ms 3В 163 0
POST /api/messages вњ… POST 3.00 ms 5.00 ms 6.00 ms 2В 516 0
GET /api/notifications вњ… GET 3.00 ms 7.00 ms 11.00 ms 3В 137 0
POST /api/notifications вњ… POST 4.00 ms 5.00 ms 6.00 ms 2В 395 0
POST /api/uploads вњ… POST 3.00 ms 8.00 ms 13.00 ms 3В 024 0
GET /api/search вњ… GET 3.00 ms 8.00 ms 13.00 ms 3В 067 0
GET /api/admin/metrics вњ… GET 3.00 ms 8.00 ms 12.00 ms 3В 003 0

Thresholds

Metric Threshold Status
p99 latency ≤ 500 ms ✅ Pass
Error rate ≤ 1% ✅ Pass
Min RPS ≥ 50 ✅ Pass

Environment

  • Node.js: v20.18.1
  • Platform: win32
  • Architecture: x64

Thresholds

Threshold Value
p99 latency ≤ 500 ms
Error rate ≤ 1%
Min RPS ≥ 50

Closes #30

github-actions Bot added a commit that referenced this pull request May 17, 2026
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