Closed fabb closed 1 year ago
Unfortunately it's a closed-source project. If you need more detailed information about something, please let me know.
A reproduction would be helpful, we can't investigate based on this report.
Yeah, I understand that though I don‘t know where to start. Our project is huge and reducing it to something that still shows the issue but is open-source-able would be a lot of work i currently cannot invest. For the time being I just hope someone with an open source project has the same issue (maybe one of the upvoters?). I can offer to add debug statements to narrow down the cause (if you have suggestions), or to try new canary versions.
Based on the paths above, I guess this website is https://www.willhaben.at/iad ? Not sure whether this information is useful for coming up with a theory of what is making it slower, but at least it shows the general complexity of the pages...
reducing it to something that still shows the issue
Maybe instead of a reduced test case, what about listing out some things that not all applications would use:
next start
to serve?)_document.js
, _app.js
(and what you're generally doing there)I guess since you are not using the Image
component, it could also possibly be unrelated to the image change, but related to another change between those versions. Did you take a detailed look at the other changes in 10.0.8
? (I'm assuming that this already caused problems with 10.0.8
)
Unfortunately it's a closed-source project. If you need more detailed information about something, please let me know.
A reproduction would be helpful, we can't investigate based on this report.
Please see my comment here https://github.com/vercel/next.js/issues/24948#issuecomment-839428991 , most likely related to the same issue, if the debug url I've set up can be of any help.
Based on the paths above, I guess this website is https://www.willhaben.at/iad ? Not sure whether this information is useful for coming up with a theory of what is making it slower, but at least it shows the general complexity of the pages...
Well this exact url is served from a legacy system, but yes, this is the domain of our application. /iad/immobilien and /iad/gebrauchtwagen is served from our next.js application.
Maybe instead of a reduced test case, what about listing out some things that not all applications would use
Ok, I‘ll do a write-up in the next few days.
So much for now: we‘re mixing SSR (with getInitialProps) and SSG, but since SSG ist extremely fast anyways, we don‘t really see changes there. We don‘t use ISR. We use styled-components which could have an impact on SSR render time (collecting styles in _document).
Did you take a detailed look at the other changes in
10.0.8
? (I'm assuming that this already caused problems with10.0.8
)
We tried updating to 10.0.9 some weeks ago, but our application ran into a crash cycle so we needed to roll back to 10.0.7.
https://github.com/vercel/next.js/issues/23189#issuecomment-802675596
Ok, so here we go.
Custom Next.js configuration:
next-plugin-custom-babel-config
and next-transpile-modules
(because of monorepo)Custom express server:
unleash-client
/health
endpoint for kubernetes livenessProbe and readinessProbednscache
prom-client
compression
cookie-parser
set-cookie
, partially based on unlease feature toggle statesexpress.static
_document.tsx
:
custom next/document head without preload to improve LCP
<style>
for self-hosted font<script noModule />
referencing core-js-bundle/minified
using the plugin-static mentioned above_app.tsx
:
getInitialProps
getInitialProps
for current component and measure getInitialProps
time and add it as custom header to responsecomponentDidMount
componentDidCatch
: capture exception with Sentryrender
react-redux
Provider (legacy, only used for one page anymore)react-toastify
useEffect
Note that we use styled-system (actually a custom fork of it), which means there is some runtime overhead for generating all the css classes on top of the styled-components overhead.
If you need to know anything in more detail, let me know. Thanks for helping!
Awesome writeup @fabb , thanks!
@timneutkens could any of these details relate to a performance regression when using the newer versions of Next.js? (either somehow related to the image optimization changes or not at all)
I tried again with next.js 11.0.1. It's even worse there, the response times worsened for ~25%. (updated from 10.0.7 to 11.0.1 with 100 concurrent pods)
There's an option to use sharp
in the latest canaries (I'm guessing probably to be fully released in the next days too)
https://github.com/vercel/next.js/discussions/27073#discussioncomment-1041672
I'll try that, but we are not using Automatic Image Optimization. I've also disabled this feature in next.config.js:
images: {
disableStaticImages: true,
}
Right yeah, wonder if maybe it's related to something else then...
Is there anything more that we can provide so you can better find out what the issue is? As said above, an example project is rather hard to do, especially since we would need to demonstrate the impact of a realistic load too. Are there some critical points where we could add logging to find out more? Or would a (paid) remote debug session help?
I'm facing the same issue with the images as well. All images, including pages that has few images on page are taking longer. Would a copy of our package.json and package-lock.json help with some way?
@royjosefsson wrong issue, this issue is about a slowdown that is NOT related to images.
Still happens in next.js 12.0.1. The screenshot shows the upgrade from next.js 10.0.7 to 12.0.1. The pod count and resources have not been changed during that deployment.
It would be super helpful if you could help us further narrow down the canaries where these issues started appearing and getting worse for you. I wouldn't recommend running the canaries in production, but perhaps you could do a local build with a canary or minor release, get a good sample of response times, and bisect to the next version?
It sounds like the first regression was between 10.0.7 and 10.2.0, and there was another between 10.2.0 and 11.0.1, so it would be very useful if you could help narrow those down to separate canaries. Thank you!
Thank you, we will try that. If we cannot find it we probably need to do some node profiling.
A wild guess would be that it’s caused by the code that fixed the memory leak that was introduced in 10.0.9, but let‘s see. https://github.com/vercel/next.js/issues/23189
We tried to find the issue by running our app locally with mocked network responses and executing a lot requests with Apache Bench (ab
) against the app. Unfortunately we could not find a difference between 10.0.7, 10.2.0 and 12.0.1 like this. In production we clearly see the difference though.
The problem is that updating to newer canaries in production to find the culprit is not feasible because versions >=10.0.8 and <10.2.0 have a memory leak that instantly cause OOMs.
Do you have other ideas? Would you be able to spot issues if we provided node.js cpu profiling generated with next.js versions 10.0.7, 10.2.0 and 12.0.1?
Still slow render times in 12.1.0 compared to 10.0.7
roughly 30% worse for SSR pages.
Please verify that your issue can be recreated with next@canary
.
please verify canary
label?We noticed the provided reproduction was using an older version of Next.js, instead of canary
.
The canary version of Next.js ships daily and includes all features and fixes that have not been released to the stable version yet. You can think of canary as a public beta. Some issues may already be fixed in the canary version, so please verify that your issue reproduces by running npm install next@canary
and test it in your project, using your reproduction steps.
If the issue does not reproduce with the canary
version, then it has already been fixed and this issue can be closed.
canary
?The safest way is to install next@canary
in your project and test it, but you can also search through closed Next.js issues for duplicates or check the Next.js releases. You can also use the GitHub template (preferred), or the CodeSandbox or StackBlitz templates to create a reproduction with canary
from scratch.
canary
now?Next.js does not backport bug fixes to older versions of Next.js. Instead, we are trying to introduce only a minimal amount of breaking changes between major releases.
An issue with the please verify canary
that receives no meaningful activity (e.g. new comments that acknowledge verification against canary
) will be automatically closed and locked after 30 days.
If your issue has not been resolved in that time and it has been closed/locked, please open a new issue, with the required reproduction, using next@canary
.
Anyone experiencing the same issue is welcome to provide a minimal reproduction following the above steps. Furthermore, you can upvote the issue using the :+1: reaction on the topmost comment (please do not comment "I have the same issue" without repro steps). Then, we can sort issues by votes to prioritize.
We look into every Next.js issue and constantly monitor open issues for new comments.
However, sometimes we might miss one or two due to the popularity/high traffic of the repository. We apologize, and kindly ask you to refrain from tagging core maintainers, as that will usually not result in increased priority.
Upvoting issues to show your interest will help us prioritize and address them as quickly as possible. That said, every issue is important to us, and if an issue gets closed by accident, we encourage you to open a new one linking to the old issue and we will look into it.
This issue has been automatically closed because it wasn't verified against next@canary. If you think it was closed by accident, please leave a comment. If you are running into a similar issue, please open a new issue with a reproduction. Thank you.
This closed issue has been automatically locked because it had no new activity for a month. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you.
What version of Next.js are you using?
10.2.0, 10.2.1-canary.3, 11.0.1, 12.0.1
What version of Node.js are you using?
14.16.1
What browser are you using?
all
What operating system are you using?
all
How are you deploying your application?
own k8s cluster with custom express server
Describe the Bug
When updating from 10.0.7 to 10.2.0 or 10.2.1-canary.3 with webpack 4, response times and getInitialProps render times of real user traffic increase by 8-12%.
We are not using next.js automatic image optimization at all. Note that for the traffic response time we only measure the initial html request, not requests for
_next
assets and chunks.The dotted vertical line marks the release. We are doing a rolling release with k8s, it took around 8 minutes until all new pods took over.
We are running 100 pods in parallel and have around 4k requests/min (pretty stable during the time in the graph), so the average reponse time graph should be reliable.
We also tried 10.2.1-canary.3 and 11.0.1 with webpack 5, but response times were even slightly worse than with webpack 4.
Expected Behavior
Render times should not increase when updating next.js.
To Reproduce
Unfortunately it's a closed-source project. If you need more detailed information about something, please let me know.