How can we scale it?
Suppose i have millions of static pages. By default nextjs keeps these pages in the local disk. When the number of pages increases then disk size might get exceed.
Lalit That is where my question comes. getStaticProps, getStaticPaths and ISR keeps the pages in local disk. Suppose i want to serve the page from CDN to reduce the load on the server. Then can we do this at run time, i mean upload new pages on to the CDN at run time.
Rahul Kumar If you use any service like Vercel, they handle all the caching for you. And moreover once a page is cached, any request to that page will not be counted for any bandwidth of 100GB(free plan on Vercel)!!
If you want to show new content without any rebuilds, you can do it too! But if your content resides beside your source code, you will have to redeploy. But if you have your data hosted in any CMS or a database, you can just add the fallback in getStaticProps to either blocking or true.
If you set it, first it will look for the content in cache, if not found, a static page is built and then cached. In Vercel, pages which are built at runtime are also persisted across deploys.
I hope this clears it, please do ask doubts if any :)
Aiyush Gupta
I'm a multidisciplinary student whose won a global NASA competition, cycled the length of the UK and has over 25K views on my tool AnglEase!
Brilliant :)