Parallelized SSG Pages #23957
Replies: 7 comments
-
checkout this rfc #11552 |
Beta Was this translation helpful? Give feedback.
-
Thank you @c0b41 |
Beta Was this translation helpful? Give feedback.
-
Hi, building SSG pages is parallelized currently. We create a worker for each CPU core you have available on your system and distribute rendering the SSG pages between these workers (related code). You can also leverage the fallback feature which allows you to only prerender the most important pages and then render any additional ones after the build on-demand |
Beta Was this translation helpful? Give feedback.
-
So I have an Idea. The biggest reason we have fallback:false is because we’re using SSG for SEO purposes, especially speed. Doing it on runtime would defeat the point. What if, instead of running getStaticPaths before getStaticProps, we run a single path into getStaticProps (to make sure it works at build time). Afterwards, we run the entire result of getStaticPaths as a form of cold hydration. This would eliminate the crazy high build times on these large catalog sites, give you the SEO and SSG benefits, and introduce a more async build step for building these pages. We can still report any failures with this back somewhere through error reporting. The only issue I see in this is invalidating a build if errors happen in the cold hydration step, but there isn’t a good solution for that in the current fallback:true method anyways. In fact, at least you can pre-emptively react to it this way. Thoughts? Cc @rauchg |
Beta Was this translation helpful? Give feedback.
-
It's unclear what you're trying to achieve exactly 🤔 Do you just want to prerender all pages? As @ijjk said we already parallelize to the maximum possible on the machine you run |
Beta Was this translation helpful? Give feedback.
-
Hey! I'm re-opening this as I'm still using a custom solution that I think the rest of Vercel/Next's customers would benefit from. Maybe I was too verbose, but basically, I want an async getStaticPaths method that gets called after the build is done to warm up the cache. Maybe a What I do now is that I have The benefit from this is that I have low build times (as opposed to our previous 30 minute build time where Vercel has to build thousands and thousands of pages), and I get the SEO benefits of pre-building all of my static pages. |
Beta Was this translation helpful? Give feedback.
-
Have you tried the new |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
Feature request
Is your feature request related to a problem? Please describe.
When building SSG pages, getStaticProps should be parallelized as much as possible instead of being synchronous. For example, we have 4000 pages coming from the same file on our website, and the build now takes ~14 minutes instead of 2 minutes.
Describe the solution you'd like
Parralelize all getStaticProps coming out of a single getStaticPaths call.
Describe alternatives you've considered
Turning off SSG, or somehow detecting if we're on master and only enabling it there (somehow).
Beta Was this translation helpful? Give feedback.
All reactions