Skip to content

benchmark: report latency percentiles in http benchmarks - #67001

Open
bruno-buuhvprojects wants to merge 1 commit into
nodejs:mainfrom
bruno-buuhvprojects:benchmark-http-latency
Open

bruno-buuhvprojects wants to merge 1 commit into
nodejs:mainfrom
bruno-buuhvprojects:benchmark-http-latency

Conversation

@bruno-buuhvprojects

Copy link
Copy Markdown

The http benchmarks only report throughput, so a change that affects tail
latency under load can't be seen in the results. autocannon already computes
latency percentiles and wrk --latency prints them, but
_http-benchmarkers.js only reads the requests per second.

This PR parses p50, p90, p99 and p99.9 from autocannon, wrk (also wrk2 output)
and the test double, passes them as an optional latency field in the report,
and prints them in the simple output format:

http/simple.js c=500 benchmarker="autocannon": 16,217.34 (latency ms: 50%=28 90%=34 99%=257 99.9%=270)

The CSV output, compare.js, scatter.js and the R scripts are unchanged.
run.js doesn't require common.js (loading it spawns wrk -h and
autocannon -h), so the formatting is repeated there, like the rate
formatting already is.

Known limits: autocannon records whole milliseconds, and h2load reports no
percentiles.

If this direction is fine, a follow-up could add compare.js --metric=p99 and
a constant-rate option mapped to autocannon -R, which corrects for
coordinated omission.

How I verified

  • Ran the 13 benchmarks that use bench.http (http, https, http2) through
    benchmark/run.js test with the test double.
  • Ran http/simple.js with autocannon and checked the CSV output is unchanged.
  • Checked the wrk parser against sample wrk and wrk2 output.
  • eslint and lint-md pass on the changed files.

I couldn't run the full test suite, since it needs a binary built from main.

AI disclosure

I used a coding agent to help write this change. I reviewed the diff, ran the
checks above myself, and can explain the implementation.

@nodejs-github-bot

Copy link
Copy Markdown
Collaborator

Review requested:

  • @nodejs/performance
  • @nodejs/tsc

@github-actions

Copy link
Copy Markdown
Contributor

Welcome to Node.js, and thank you for your first contribution!

Before review, please take a moment to read:

Please make sure every commit is signed off. For a first pull request, GitHub Actions require collaborator approval and Jenkins CI must be started by a collaborator or triager, so an initial wait is normal.

The http benchmarks only reported throughput, although autocannon
already computes latency percentiles and wrk can print them. Tail
latency under load is invisible in the results, so changes that
affect it cannot be measured with the benchmark suite.

Parse p50, p90, p99 and p99.9 from autocannon, wrk (with --latency)
and the test double, pass them along as an optional `latency` field
of the report, and print them in the simple output format. The CSV
output and the comparison tools are unchanged.

Signed-off-by: Buuh Uchiha <[email protected]>
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.

2 participants