Slow response for static pages from Netlify Edge

On this nextjs site - I have generated static html (SSG) for blog to make it faster. Earlier they were server rendered (SSR)

But I see the response is too slow. TTFB is bad even when it is being served from Edge runtime.

I am struggling to meet core web vitals - LCP but page only takes long.

Please take a look and tell what am I missing here?

TTFB test source - 1

TTFB test source 2

Site links
SSR - How to Make a Resume with No Experience
SSG / html - How to Make a Resume with No Experience

I have done cdn tests for both which also tells the same story. Here are links -
Prod with SSR - CDN Performance Check | Uptrends
dev with SSG - CDN Performance Check | Uptrends

I am attaching HAR files. In har files - I see LCP for server rendered content is less than static html. This should not be the case

Pls help.
SSR - 1millionresume.com.har (2.0 MB)
SSG - dev.1millionresume.com.har (1.8 MB)

There’s no static files in Next.js 14 and Next.js Runtime v5: After Upgrading from Next.js 14.0 to 14.2 NetlifyCacheHandler.get fails - #5 by hrishikesh

Everything is server-rendered (output is stored in Netlify Blobs to cache and compare for future requests) and it would take long if your page generation logic takes long.

So SSG would work as follows:

  • During the build, page would be generated
  • It would be moved to Netlify Blobs before deployment
  • When the page is requested, it would be handled by the SSR Function
  • The generated page would be fetched from Blobs
  • Next.js will determine the cache freshness
  • Since you’re saying it’s a static file, I assume there’s no revalidation of any sort that’s happening. In this case, the cached file would be served as it is.

thanks for response. I see below cache header on document

and you say same cache rule will be used which means - no cache?

I read over internet that Netlify will serve these static pages from edge locations so it will be faster.

That header is for the browser: Better Living Through Caching (netlify.com)

Netlify uses the netlify-cdn-cache-control header: Caching | Netlify Docs

You can check the headers in the screenshot you sent:

cache-status: Netlify Durable; hit; fwd=stale
cache-status: Next.js; hit
cache-status: Netlify Edge; fwd=stale

That proves the caching is working as intended.

As I mentioned before, there are no static pages with Next.js 14 :slight_smile: Please refer to the linked thread.

If you want static files, use Next.js in export output.

@hrishikesh Hi! Yes you’re right, cache mechanism is working, still sometimes it seems that the response is not immediate (like a revalidating process is on the way). Subsequent requests, though, are fast; I expect that, since I’m using SSG with no revalidate, that response are “immediate” (with vercel this happens), but not with netlify :slight_smile: So if nexts 15 has no static files, why vercel responses are always fast, and netlify sometimes no?

And by the way, I don’t know where you say that nextjs has no static files anymore, because if I use SSG, after the build, I see the html static files :slight_smile: It seems that the Netlify implementation of nextjs is not ideal

You haven’t specified any site to check. CDN cached responses will be immediate, Next.js cache will not be immediate.

I’ve already answered this in the linked thread. Please refer to that.

@hrishikesh Sure! The site to check is this one → https://unica-casa.netlify.app/

Could you please take a look? Thanks! :slight_smile:

Also, you didn’t answer to this → So if nexts 15 has no static files, why vercel responses are always fast, and netlify sometimes no?

I understand that I’m using the free tier so that’s fine, but as I understand, there’s no performances difference between free accounts and paid accounts so it isn’t either that the problem; it actually seems that the netlify nextjs runtime is not optimized 100% :slight_smile: