Slow initial load time on SSG with nextjs

Hi, I am getting some extremely slow response times for First page load and first contentfull paint from my nextjs website on netlify.

It takes 4.25s to load the html of 9.4kB …

the site is this one:

More numbers:

Hi @koraysels,

Since SSR relies on Netlify Functions, I’d say this is expected behaviour as Functions don’t run on CDN - they run in US by default, so the further away you’re from US, the longer it will take.

For pro and above customers, we can change the function region based on from where you’re expecting most traffic.

damn I meant SSG …
i have acronym dyslexia apparently. Statically generated… (I only use getStaticProps)

Right now updated to the netlify beta plugin plugin and it seems to speed up the load time significantly

1 Like

Aha, sorry probably I read it wrong. I see you were using SSG from start, but so many happen to use SSR with NextJS that it has become kind of default to read it like that now.

Great to know the plugin is working fine.

actually not completely fixed with the beta plugin. I still get suspiciously long load times on pretty small json files like almost 2 seconds for 5kB. which is just a static json file that should be loaded instantly through CDN right ?

Could you share the request IDs of the timings that you think are slow?

for example this json file takes 6 seconds to load… is that normal?

https://iedereenstadsdichter.staging.fined.io/_next/data/S2KxK8E2uefmZL1ZTw7_G/verhaal/provinciehuis.json

Hey there, @koraysels :wave:

Can you share a HAR file or a request ID? We cannot see the slow load without this. When we click on the link you provide, it take 719 milliseconds to load.

the problem is that it takes very long the first time… when i repeat the requests it is in fact a lot faster like you said. It seems like ISR is responsible for this behaviour. I do not want this, i want to cache it on build. how can i do that ?

hi there @koraysels - can you create a HAR file as hillary asked and share that with us somehow? that is definitely the next step in debugging. thanks!

https://toolbox.googleapps.com/apps/har_analyzer/

1 Like

Yeah sure, sorry :wink: here it is (from another request but this one takes even longer…)

→ HAR file on google drive

Hey @koraysels,

We were able to see that request and that it took really long for you to load. We’ll discuss this with the engineers about some possible causes, and then update accordingly.

Hey @koraysels,

We had a chance to talk with our engineers. So we can see that, that specific JSON file was loaded using an ODB. Do you continuously face slow loads for that file? Because, our engineers believe that, since it’s an ODB, the first time it was loaded, it might have taken time to build because of some expensive computation, but once it’s cached (like it is now), it loads perfectly fine. This is the URL that we tested: https://61e83538a2710b0008a180d1--iedereenstadsdichter-frontend.netlify.app/_next/data/dzGbQ40d-kbMc8DeyNBBq/verhaal/babbeltuin-deurne.json

1 Like

i have the same bug

https://dev--lita-web-test.netlify.app

1M js file load need 10+ms

  1. etag:

“09ced96963326354574b51a8d0693c72-ssl-df”

  1. server:

Netlify

  1. strict-transport-security:

max-age=31536000; includeSubDomains; preload

  1. vary:

Accept-Encoding

  1. x-nf-request-id:

01GCVFJGSYJ3F4027FVEAJ8Q71

飞书20220913-211327

x-nf-request-id:

01GCWWM3J3QF0BFJGNGPD7TRNG

If so, I dare not use netlify!!!

Please help me this

Hey there, @JerrySir :wave:

Thanks so much for reaching out. I see that you were working with our Support Engineers via email support. Please follow up via email if you have further details, questions, etc.

thanks!