serverless-next.js icon indicating copy to clipboard operation
serverless-next.js copied to clipboard

Slow ISR page load times

Open renewablezip01 opened this issue 3 years ago • 2 comments

Issue Summary

I'm experiencing slow page load times using ISR.

Actual behavior

Running a page with ISR enabled causes this issue, I had my revalidate set on 60. ISR caused initial document to be loaded slow on a consist base of 700-800ms on each reload, and there were times where it hit 900-1200ms. I then tried enabling SSR which brought it down to 150-200 and then SSG to around 7-15ms.

Here is a picture of the document asset loading slowly, while other assets are at around 2-4ms chrome_ilJh67riuZ

During the testing of ISR I also checked on the lambda dashboard to notice this: chrome_PVzDyAgixf

My requests are erroring out?

I would like to point out that it was only the document which was fetching slowly whilst all other assets were very fast without any issues.

I doubled check to ensure that my lambdas were warm at the point of testing to get solid stats. And I also tried both the latest version and the alpha version of serverless-nextjs.

Expected behavior

I expected the ISR to have loading times equivalent to static pages, but I was apparently wrong in this case. I'm unsure to what exactly might be causing this or if this is just happening to me. - But comparing this to lets say Vercel with same setup the ISR page loads as fast as the static pages.

Steps to reproduce

Setting the revalidate attribute on a getStaticProps and then pushing to AWS, after that open the site and go to the network tab and refresh the page multiple times and check on the document, on how fast it's being recieved.

Versions

  • OS/Environment: Windows
  • @sls-next/serverless-component version: 3.6.0
  • Next.js version: 12.0.7

Serverless.yml: Just a simple serverless.yml config, nothing fancy.

myNextApplication:
  component: "@sls-next/[email protected]"

Checklist

  • [x] You have reviewed the README and FAQs, which answers several common questions.
  • [x] You have reviewed our DEBUGGING wiki and have tried your best to include complete information and reproduction steps (including your configuration) as is possible. As there is only one maintainer (who maintains this in his free time) and thus very limited resources, if you have time, please try to debug the issue a bit yourself if possible.
  • [x] You have first tried using the most recent latest or alpha @sls-next/serverless-component release version, which may have already fixed your issue or implemented the feature you are trying to use. Note that the old serverless-next.js component and the serverless-next.js plugin are deprecated and no longer maintained.

renewablezip01 avatar Jan 11 '22 02:01 renewablezip01

Following

peckpeck20 avatar Apr 21 '22 14:04 peckpeck20

I'm also encountering this issue, and the only solution has been npm run build, then npm run start while running my back-end server in another terminal. When I start the production build, then the app is lightning quick again, but without it my page load on ISR sections is extremely laggy.

It's inefficient because I have lost the ability to make use of Fast Refresh at all in my next.js app and must wait for a full rebuild.

techieeliot avatar May 06 '22 03:05 techieeliot