Skip to content

Conversation

anonrig
Copy link
Contributor

@anonrig anonrig commented Oct 10, 2025

We saw that under high concurrency, Nth request was taking a lot more time than others. This was caused by the composable cache. Prior to this pull-request, cache was consuming all data stream (the response of the page), just to access it and later convert it to a stream (and discard the data cached). This created a lot of GC pressure and caused a lot of unnecessary memory usage.

Copy link

changeset-bot bot commented Oct 10, 2025

🦋 Changeset detected

Latest commit: 93ef8d3

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@opennextjs/aws Patch
app-pages-router Patch

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

@anonrig anonrig force-pushed the yagiz/improve-cache branch from 29b63bb to 40a1b30 Compare October 10, 2025 13:42
Copy link

pkg-pr-new bot commented Oct 10, 2025

Open in StackBlitz

pnpm add https://pkg.pr.new/@opennextjs/aws@1002

commit: 93ef8d3

}
// Use Buffer.concat which is more efficient than manual allocation and copy
// It handles the allocation and copy in optimized native code
const buffer = Buffer.concat(chunks, totalLength);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once I look at this with a different perspective, I think this might be faster, but I didn't run a separate benchmark for this. @jasnell @vicb

@anonrig anonrig changed the title improve composable-cache performance improve composable-cache, converters and header parsing performance Oct 10, 2025
@anonrig anonrig force-pushed the yagiz/improve-cache branch from 64e30bf to 0876873 Compare October 10, 2025 14:34
@anonrig
Copy link
Contributor Author

anonrig commented Oct 10, 2025

Closing in favor of separate pull-requests.

@anonrig anonrig closed this Oct 10, 2025
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.

1 participant