perf(world-vercel): use HTTP/2 with connection multiplexing#1019
perf(world-vercel): use HTTP/2 with connection multiplexing#1019
Conversation
🦋 Changeset detectedLatest commit: 2552392 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 (73 failed)astro (2 failed):
example (1 failed):
express (2 failed):
fastify (2 failed):
hono (2 failed):
nextjs-turbopack (4 failed):
nextjs-webpack (4 failed):
nitro (5 failed):
nuxt (5 failed):
sveltekit (39 failed):
vite (7 failed):
🌍 Community Worlds (42 failed)turso (42 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.
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.
9b895c7 to
b875ea0
Compare
The global fetch in Vercel Functions is patched by the runtime and doesn't properly support the undici dispatcher option. Use undici's fetch directly to ensure h2 dispatcher works correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
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