vercel / next.js

The React Framework
https://nextjs.org
MIT License
125.9k stars 26.87k forks source link

Slower Response Times when updating from 10.0.7 to 10.2.0 or 11.0.1 or 12.0.1 (with Disabled automatic image optimization) #25032

Closed fabb closed 1 year ago

fabb commented 3 years ago

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.

Screenshot 2021-05-12 at 10 57 06

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.

timneutkens commented 3 years 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.

fabb commented 3 years ago

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.

karlhorky commented 3 years ago

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...

karlhorky commented 3 years ago

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:

  1. custom Next.js configuration
  2. what are you doing with the custom express server (on a granular level - eg. why can't you just use the normal Next.js next start to serve?)
  3. use of Next.js integration points, such as _document.js, _app.js (and what you're generally doing there)
  4. what type of static generation / server-side rendering are you using? any interesting features like "Incremental Static Regeneration"?

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)

goguda commented 3 years 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.

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.

fabb commented 3 years ago

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.

fabb commented 3 years ago

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).

fabb commented 3 years ago

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)

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

fabb commented 3 years ago

Ok, so here we go.

Custom Next.js configuration: