feat: add HTTP/2 load testing infrastructure#798
Merged
Merged
Conversation
Contributor
|
CodeAnt AI is reviewing your PR. Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Contributor
|
CodeAnt AI finished reviewing your PR. |
3 tasks
Adds a loadtest/ directory with scripts for benchmarking HTTP/2 transport throughput against the Runloop API. Includes baselines for raw node:http2, undici, and the SDK client at various concurrency levels. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add res.on('error', reject) so the promise settles if the server
aborts mid-response, instead of hanging indefinitely.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Update the SDK load harness for the new default transport: - `loadtest.ts` imports `../src/sdk.ts` (like the sibling loadtest scripts) so it always exercises the SDK code in this checkout, not a published build. - Set `http2` explicitly: HTTP/2 is now the default, so HTTP/1.1 must be opted into with `http2: false`. `USE_HTTP2` defaults to on; `USE_HTTP2=0` benchmarks HTTP/1.1. Relabel the HTTP/2 mode as native `node:http2`. - Drop the `@runloop/api-client` file dependency and `type: module` from `loadtest/package.json` (the latter would force the shared loadtest dir to ESM and break `push-to-loki.ts`); keep `undici` so the raw undici-vs-native comparison still runs — that comparison motivated the native H2 transport. - Document the real-API comparison scripts (SDK + raw undici/node:http2/https) in the loadtest README. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Contributor
|
CodeAnt AI is running Incremental review |
Contributor
Thanks for using CodeAnt! 🎉We're free for open-source projects. if you're enjoying it, help us grow by sharing. Share on X · |
Contributor
|
CodeAnt AI Incremental review completed. |
The raw undici / node:http2 / node:https probes predated the repo's prettier/eslint style (double quotes), which fails `eslint .`. Format them so the rebased branch is lint-clean; no behavior change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…nput Address CodeAnt review on the loadtest harness: - undici-test / raw-fetch-test: collect per-request results instead of `Promise.all` fail-fast. One transient network error (or a mid-stream response abort in raw-fetch) no longer hangs or discards the whole run; failures are counted as `network_error` in the status breakdown. - raw-fetch-test: settle each request exactly once across end / aborted / error / request-error paths (previously a mid-stream abort could hang the batch indefinitely). - h2-test: reject NUM_CONNECTIONS < 1 up front (previously dereferenced clients[0] === undefined and crashed). - All scripts: guard the latency block against zero results so an empty run doesn't throw on latencies[0]. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
yoon-park-rl
approved these changes
Jul 10, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
User description
Summary
A
loadtest/toolkit for benchmarking the SDK's request handling, plus raw-transport baselines. The SDK harness (loadtest.ts) fires a burst ofdevboxes.createcalls at a deliberately nonexistent blueprint (bp_nonexistent_loadtest_00000): every request fails fast server-side (HTTP400, no devboxes created), isolating client + server request handling from provisioning — i.e. "can the stack absorb many requests at once."What changed in this update
loadtest.tsnow imports../src/sdk.ts(like the sibling loadtest scripts) instead of the published@runloop/api-client, so it always exercises the SDK code in the current checkout — not a stale build.http2: false.USE_HTTP2defaults to on;USE_HTTP2=0benchmarks HTTP/1.1. HTTP/2 mode relabeled as nativenode:http2.node:http2/node:httpsprobes are retained — comparing undici's HTTP/2 multiplexing againstnode:http2is the comparison that motivated building the SDK's ownnode:http2transport.undicinow lives inloadtest/package.json, so these stay runnable even after the SDK drops itsundicidependency (chore(deps): remove dead undici HTTP/2 adapter and dependency #817).type: module(it would force the sharedloadtest/dir to ESM and breakpush-to-loki.ts) and the@runloop/api-clientfile dependency.Scripts (real-API)
loadtest.tsundici-test.ts,undici-single-conn.ts,undici-debug.tsh2-test.ts,h2-single-conn.tsnode:http2raw-fetch-test.tsnode:https(HTTP/1.1 keep-alive)alpn-check.tsh2negotiation checkUsage
Relationship to #815
The HTTP/2-as-default behavior (and the single shared H2 pool + idle-session
unref) lands in #815. Run this harness against a checkout containing #815 to exercise the proposed transport; the comparison numbers in #815's description were gathered with this harness against that branch. On plainmain(pre-#815),loadtest.tsin HTTP/2 mode will not exit on its own because idle H2 sessions aren'tunref'd until #815.Test plan
loadtest.tsruns against the in-repo SDK for both transports; HTTP/1.1 and (against feat: default to HTTP/2 transport on Node #815) HTTP/2 complete and exit cleanly, all requests400(no devboxes created).eslintclean onloadtest.ts.🤖 Generated with Claude Code
CodeAnt-AI Description
Add real API load tests for HTTP/2, HTTP/1.1, and raw client comparisons
What Changed
Impact
✅ Clearer HTTP/2 vs HTTP/1.1 benchmark results✅ Fewer stuck load tests when responses fail mid-stream✅ Easier comparison of SDK and raw client request handling💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.