-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
fix(astro): Improve ssr performance (astro#11454) #13195
fix(astro): Improve ssr performance (astro#11454) #13195
Conversation
…o into mod-164-add-initial-tests
🦋 Changeset detectedLatest commit: 03f555b The changes in this PR will be included in the next version bump. 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 |
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.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
CodSpeed Performance ReportMerging #13195 will improve performances by 49.84%Comparing Summary
Benchmarks breakdown
|
Can someone provide their $0.02 on https://github.com/withastro/astro/pull/13195/files#diff-d312d8fce663b920b083d795af0cf0ca4f20374f3467998906ec00ef2b85f6eaR321, I'm pretty sure I need to do an explicit try/catch around here for the non-promise scenario, but I'm curious as to how this would manifest. |
.changeset/shaggy-deers-destroy.md
Outdated
'astro': minor | ||
--- | ||
|
||
Improves SSR performance for synchronous components by avoiding use of Promises. |
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.
Just noting that this can totally sound a bit like the blog post here! H.Y.P.E.!
I've updated the code in question, it resolved the behaviour described in #13195 (comment) fwiw I'm happy with the PR now. |
Thank you, @MatthewLymer. The code looks good, and we have no particular concerns. We will release this PR tomorrow and will be on the lookout for possible regressions. If you have time, energy and interest, feel free to stick around and see if you can help us triage and fix possible regressions. 😄 |
I'm curious though, why do preact and qwik out-perform astro? Noted that solidjs do as well |
@ematipico I can definitely help as I'd like to ensure it's the best possible outcome. The PR was authored on behalf of my company, @datner I haven't profiled either the preact or qwik islands, but my assumption right now is the eager loading of all components and rendering to a temporary buffer. Astro's current implementation would probably be faster with the use of more asynchronous components, as rendering to a buffer to synchronous components is largely just overhead. |
@MatthewLymer we're going to highlight this in our release tomorrow and I've given you a shout-out in the blog. Would you like a credit for your company too? I'm happy to add one. See the example here where I credited work done for the Washington Post: https://astro.build/blog/astro-520/ |
@ascorbic That's awesome, yes please, if you could credit my company, it would be appreciated. |
Great! Do you and/or the company have X and/or Bluesky accounts so we can tag you in posts? |
@ascorbic we don't have a social media presence, however, instead of mentioning "VerticalScope Inc." above, can you instead mention "Fora" at https://fora.com instead, which is the business unit I'm working in. |
This is amazing! Thanks for pushing this through. Any thoughts on when this will get released? |
It's written here #13195 (comment) |
Thanks @ematipico Interestingly, our website is experiencing about 2.5x worse SSR performance, by just updating to Will do some more digging next week. |
@scott-the-brewer do you have a high level overview of what the page does, how many sync/async components, how much IO, etc? |
The rendering times in the screenshots in my previous message, was during SSR We use our own SSR adapter, essentially:
To isolate things more, I've tried on |
@scott-the-brewer thanks for the information, I've done some investigation and unfortunately haven't been able to replicate a performance regression. For my testsing I've been using the For the test, I've been using the load test with 1 concurrent and 10 concurrent users, with rendering 1,500 async components. BEFORE
AFTER
Granted it's a fairly trivial test, but I'm not sure how to replicate the results you're seeing. If you can provide a minimal reproducible example I can investigate that, or perhaps provide some CPU profiling information. |
@scott-the-brewer Can you also provide what tooling you're using to measure the performance? |
Yup, will try create a reproducible example this weekend. For reference I'm using middleware to measure this:
|
@scott-the-brewer Before you investigate further, I believe your instrumentation is giving you misleading results. In Astro, middleware returns when (or around?) the response headers have been sent and the response has started streaming, so your instrumentation is giving you an approximation of that time, not a duration of how long the request took to be completely rendered. I go over that in my comment #13195 (comment) Instead, if you could measure the performance outside of middleware (by measuring the time observed by the client), this should give you vastly different numbers, pre and post v5.3. Can you provide this information? |
Thanks @MatthewLymer will report back soon. |
Changes
Closes #11454
Promise
.Testing
~/packages/astro/test/units/render/rendering.test.js
Docs
No docs were added as this is specifically performance related refactoring.