Skip to content

Conversation

@dajinchu
Copy link
Collaborator

@dajinchu dajinchu commented Jan 13, 2026

locally this brings wrapped proxy from ~200 req/s to 500.

Against AlignableWeb, we get /sitemap from 20 req/s to ~40 (rails itself can only do 50 on direct requests)

// Why not pipe? Because Vike gives us `pipe` which sends data into a Writable, but Fastify's reply.send only accepts a ReadableStream. Passthrough can convert but causes race conditions
// We would have to pipe into reply.raw, but that skips Fastify's reply handling (like onSend hooks)
// Photon/universal-middleware solves this with some hacks around reply.body
.send(await getBody())
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was needed because we were getting "write to stream after end" issues with the streaming. it also seems to improve response time

if (pageContext._wrappedServerOnly) {
return await vikeReactRender(pageContext);
}
return { documentHtml: emptydocument };
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in wrapped mode we render twice. once for routing, then again after we get data from rails. this adds fast-path for the initial routing render.

maybe in the future vike could give us an API for routing w/o rendering

@dajinchu dajinchu changed the title dc/wrapped perf Wrapped Proxy Perf Improvements Jan 13, 2026
@dajinchu dajinchu merged commit 9a2f7ea into master Jan 14, 2026
1 check passed
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.

3 participants