First page load is always slow

I’m creating a landing page using Next.js & Builder, which is hosted on Vercel. I noticed that when I load my deployed page the first load will always be a bit slow - time to first byte from the server is around 2 seconds, but any subsequent loads are faster - TTFB is 200-300ms. The page stays fast as long as I’m visiting it, but after around 10 minutes of inactivity the next request will again take around 2 seconds. Notice that I’m strictly talking about Time to First Byte, so it’s not a case of slow client-side JS or too many imager or anything.

I did investigate a bit and on Vercel’s dashboard in the Logs section I found out that it indeed lists the Execution Duration at around 2 seconds for these loads, as shown below.

Can anyone help with this? The page I’m building will be pretty low traffic so there’s a big chance that a person visiting it for the first time will get the slow first page load. I don’t know whether this is the case of Vercel being slow or Builder SDK being slow (because it needs to fetch some data and it takes a lot of time and maybe caching is not configured properly?)

Oh btw the page I’m deploying is the stock Next.js starter project with the sample “builder demo” page that was configured automatically by the Builder SDK, I didn’t add anything else to the project.

Hello @mav,

Is there a URL for this landing page where we can reproduce and investigate the issue?

It’s an internal site that I’m working on so there’s no URL, but I finally found the solution - move the page route that generates the site based on the Builder SDK to the Edge Runtime, by adding the following line to the page route file ([[]]/page.tsx in my case since I’m using App Router in NextJS):

export const runtime = 'edge';