next.js: 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)
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.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 16
- Comments: 26 (25 by maintainers)
Ok, so here we go.
Custom Next.js configuration:
inject polyfills
@sentry import alias
TerserPlugin config
next-plugin-custom-babel-configandnext-transpile-modules(because of monorepo)bundle analyzer
custom static import plugin
some next.js configs
next.config.js
polyfills.ts
babel.config.js
plugin-static.js
Custom express server:
unleash-client/healthendpoint for kubernetes livenessProbe and readinessProbednscacheprom-clientcompressioncookie-parserset-cookie, partially based on unlease feature toggle statesexpress.static_document.tsx:styled-components style collection in `getInitialProps`
custom next/document head without preload to improve LCP
HeadWithoutPreload.tsx
preconnects, dns-prefetches, favicons
inlined
<style>for self-hosted fontcore-js polyfilling for old browsers with
<script noModule />referencingcore-js-bundle/minifiedusing the plugin-static mentioned above_app.tsx:getInitialPropsgetInitialPropsfor current component and measuregetInitialPropstime and add it as custom header to responsecomponentDidMountcomponentDidCatch: capture exception with Sentryrenderreact-reduxProvider (legacy, only used for one page anymore)react-toastifyuseEffectNote 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!
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!
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).
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.
A reproduction would be helpful, we can’t investigate based on this report.