Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

api-bench

Zero dependencies Node License: MIT Platform

Lightweight HTTP load benchmark CLI. RPS, p50/p90/p95/p99 latencies, status code breakdown. Zero dependencies.

Unlike wrk (C binary, Unix), ab (Apache Bench, system install), or autocannon (npm + deps), api-bench runs anywhere Node.js does.


Install

npm install -g api-bench

Or without installing:

npx api-bench http://localhost:3000/

Usage

api-bench http://localhost:3000/                     # 10 conn, 10s
api-bench https://api.example.com/health -c 50 -d 30 # 50 conn, 30s
api-bench http://localhost/auth -X POST \
          -H "Content-Type: application/json" \
          -b '{"user":"alice","pwd":"abc"}'
api-bench http://localhost/api -b @payload.json      # body from file
api-bench http://localhost/api --json                # JSON output

Example Output

api-bench  GET http://localhost:3000/users
  50 conn  ·  30s  ·  warmup 10 req

Results

  Requests          142,318  in 30.02s
  Requests/sec      4,741
  Throughput        2.84 MB/s
  Errors            0  (0.0%)

Latency

  min     1.2ms
  avg     10.5ms
  p50     8.1ms
  p90     14.2ms
  p95     22.4ms
  p99     48.7ms
  max     245ms

Status Codes

  200          141,892  (99.7%)
  404          426      (0.3%)

Why p99 Matters

avg lies. If most requests are fast but 1% are slow, the average looks fine — but your slowest 1% of users have a terrible experience. p95/p99 surface the worst real cases.

api-bench always shows the full latency distribution so you can spot tail-latency issues.


Options

Flag Default Description
-c, --concurrency 10 Parallel connections
-d, --duration 10 Duration in seconds
-X, --method GET HTTP method
-H, --header Add header (repeatable)
-b, --body Body string, or @file
--warmup 10 Warmup requests before measuring
--timeout 30000 Per-request timeout (ms)
--json off JSON output

License

MIT


Keywords

load testing · http benchmark · wrk alternative · ab alternative · autocannon alternative · requests per second · p99 latency · stress test · zero dependencies · cli


Built to solve, shared to help — Rushabh Shah 🛠️✨

One of 40+ zero-dependency developer CLI tools — no node_modules, ever.