SSG vs CSR for High-Volume Dynamic Content Under Build-Time Constraints
0 reputation · 06 Jan 2022, 13:33 UTC
0 reputation · 06 Jan 2022, 13:33 UTC
When architecting a Jamstack site with thousands of dynamic pages, the choice between Static Site Generation (SSG) and Client-Side Rendering (CSR) creates a conflict between build performance and user experience.
Pure SSG ensures optimal Time to Interactive (TTI) and SEO by pre-rendering HTML at build time. However, as the page count grows, build times can become prohibitive, delaying deployments. Conversely, CSR reduces build-server load by fetching data on the client, but introduces layout shifts and potential SEO degradation if crawlers struggle with JavaScript execution.
Given a requirement for near-instant initial page loads but a strict limit on total build duration, it is unclear which strategy maintains the best balance for a large-scale content library.
35775 reputation · 06 Jan 2022, 22:15 UTC
For a content library in the thousands, pure Static Site Generation (SSG) usually stops being the right default once build duration exceeds your CI/CD budget. The SEO and Time to Interactive (TTI) advantages of pre-rendered HTML are real, but they are not worth a deployment pipeline that blocks releases for 15–30 minutes. The practical balance is a hybrid: keep SSG for high-traffic, high-value pages and use Incremental Static Regeneration (ISR) or on-demand SSR for the long tail. Pure Client-Side Rendering (CSR) should be reserved for pages where SEO is irrelevant and interactivity dominates.
Confirmed: SSG build time grows roughly linearly with page count and the latency of any external data fetches. A build that renders 500 pages in two minutes will not simply scale to 50,000 pages in the same wall-clock time unless you parallelize aggressively or cache aggressively. CSR removes per-page build work entirely, keeping build duration nearly constant, but it moves rendering into the browser, increasing Time to Interactive and creating a risk that crawlers which do not execute JavaScript will see an empty shell.
Likely, but unverified for your stack: The exact page count where SSG becomes prohibitive depends on your API response times, CI concurrency, and cache hit rates. Community reports and framework documentation commonly suggest the 5,000–10,000 page range with external API calls as the point where builds exceed typical 10–15 minute CI limits, but a slow backend can make even 2,000 pages painful, while a fast, cache-friendly API can push pure SSG much further.
| Strategy | Build Cost | Initial Load | SEO Risk |
|---|---|---|---|
| Pure SSG | High, scales with page count | Fastest HTML | Low |
| Pure CSR | Low, constant | Slower TTI, layout shift | Higher if JS fails |
| Hybrid (ISR/SSR) | Moderate, on-demand | Fast for cached routes | Low with correct config |
What is the p95 latency of the data fetch required for a single page? If it is above roughly 500 ms, the transition to a hybrid model should happen at a much lower page count—potentially under 2,000—because serialized API calls will dominate build time. If it is under 100 ms with high concurrency, pure SSG may remain viable well past 10,000 pages.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.