-
Notifications
You must be signed in to change notification settings - Fork 188
perf(world-vercel): use HTTP/2 with connection multiplexing #1019
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
…equests Add undici Agent with allowH2 and pipelining to all fetch calls in world-vercel, enabling HTTP/2 multiplexing and connection reuse for both the storage API (makeRequest) and streaming API paths. Co-Authored-By: Claude Opus 4.6 <[email protected]>
🦋 Changeset detectedLatest commit: 9b895c7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 15 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
📊 Benchmark Results
workflow with no steps💻 Local Development
workflow with 1 step💻 Local Development
workflow with 10 sequential steps💻 Local Development
workflow with 25 sequential steps💻 Local Development
workflow with 50 sequential steps💻 Local Development
Promise.all with 10 concurrent steps💻 Local Development
Promise.all with 25 concurrent steps💻 Local Development
Promise.all with 50 concurrent steps💻 Local Development
Promise.race with 10 concurrent steps💻 Local Development
Promise.race with 25 concurrent steps💻 Local Development
Promise.race with 50 concurrent steps💻 Local Development
Stream Benchmarks (includes TTFB metrics)workflow with stream💻 Local Development
SummaryFastest Framework by WorldWinner determined by most benchmark wins
Fastest World by FrameworkWinner determined by most benchmark wins
Column Definitions
Worlds:
|
🧪 E2E Test Results❌ Some tests failed Summary
❌ Failed Tests▲ Vercel Production (58 failed)astro (2 failed):
example (2 failed):
express (1 failed):
fastify (5 failed):
nextjs-webpack (1 failed):
nuxt (3 failed):
sveltekit (39 failed):
vite (5 failed):
🌍 Community Worlds (42 failed)mongodb (1 failed):
turso (41 failed):
Details by Category❌ ▲ Vercel Production
✅ 💻 Local Development
✅ 📦 Local Production
✅ 🐘 Local Postgres
✅ 🪟 Windows
❌ 🌍 Community Worlds
✅ 📋 Other
❌ Some E2E test jobs failed:
Check the workflow run for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR improves request performance in @workflow/world-vercel by introducing a shared undici Agent configured to negotiate HTTP/2 and reuse a single connection via multiplexing, then wiring that dispatcher into all relevant fetch paths.
Changes:
- Add an
undiciAgent(allowH2: true,pipelining: 10) and pass it asdispatcherto the centralizedmakeRequest()fetch. - Pass the same
dispatcherto all direct streamingfetchcalls instreamer.ts. - Add
undicidependency and a changeset for a patch release.
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
packages/world-vercel/src/utils.ts |
Creates a shared undici Agent and uses it for makeRequest() fetch calls. |
packages/world-vercel/src/streamer.ts |
Threads the shared dispatcher into all streaming-related fetch calls. |
packages/world-vercel/package.json |
Adds undici as a dependency for the Agent/dispatcher. |
pnpm-lock.yaml |
Locks the new undici dependency resolution. |
.changeset/h2-client.md |
Declares a patch release note for the performance change. |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
The undici h2 Agent conflicts with duplex: 'half' streaming requests in Vercel Functions, causing connections to hang. Keep h2 for standard request/response calls in makeRequest() only. Co-Authored-By: Claude Opus 4.6 <[email protected]>
The change from fetch(new Request(...)) to fetch(url, {...}) altered
request body/header normalization, causing HTTP 400s. Restore the
original new Request() pattern and pass dispatcher as the second arg
to fetch(request, { dispatcher }).
Co-Authored-By: Claude Opus 4.6 <[email protected]>
Summary
undiciAgent withallowH2: trueandpipelining: 10to all fetch calls in@workflow/world-vercelmakeRequest()path (22 API calls) and the direct streaming fetch calls (5 calls)Test plan
🤖 Generated with Claude Code