Next.jsSSRSSGPerformance

Next.js Rendering Strategies: SSR, SSG, and ISR Explained With Real Examples

A deep dive into when to use Server-Side Rendering, Static Site Generation, and Incremental Static Regeneration — with benchmarks and real-world trade-offs.

9 min read

The Problem With "Just Use Static"

When I first adopted Next.js, I defaulted to getStaticProps everywhere. Pages loaded instantly. Lighthouse was happy. Then a client asked why their product prices weren't updating until the next deploy.

That conversation forced me to actually understand the trade-off triangle: freshness vs. speed vs. infrastructure cost.


SSG — Static Site Generation

``ts

// app/blog/[slug]/page.tsx

export async function generateStaticParams() {

const posts = await fetchAllPosts()

return posts.map((post) => ({ slug: post.slug }))

}

export default async function BlogPage({ params }: { params: { slug: string } }) {

const post = await fetchPost(params.slug)

return

}

`

When to use SSG:
  • Content that rarely changes (blogs, docs, marketing pages)
  • Data that can tolerate being slightly stale
  • Maximum performance requirements

Real performance: Pages generated at build time serve from CDN edge with ~50ms TTFB globally.

SSR — Server-Side Rendering

`ts

// Forces dynamic rendering

export const dynamic = 'force-dynamic'

export default async function DashboardPage() {

const user = await getCurrentUser()

const stats = await fetchUserStats(user.id) // fresh every request

return

}

`

When to use SSR:
  • User-specific data (dashboards, account pages)
  • Pages that depend on request cookies/headers
  • Content that must be 100% fresh on every load

The cost: Every request hits your server. At scale, this means more compute.

ISR — Incremental Static Regeneration

This is where Next.js truly shines. Generate static at build time, regenerate in the background after N seconds.

`ts

export const revalidate = 60 // revalidate every 60 seconds

export default async function ProductPage({ params }: { params: { id: string } }) {

const product = await fetchProduct(params.id)

return

}

``

When to use ISR:
  • E-commerce product pages
  • News articles
  • Any content that changes, but not on every request

The magic: First request after stale period triggers background regeneration. Users always get a response — never a loading spinner.

Benchmarks From Production

|----------|------|-----------|-----------|

StrategyTTFBInfra CostFreshness
SSG~50msVery LowBuild-time
ISR (60s)| ~50msLowUp to 60s stale
SSR~200ms| MediumAlways fresh


My Mental Model

  • Default to SSG — if the content doesn't depend on the request
  • Use ISR — if content changes but not every second
  • Use SSR — only for user-specific or request-dependent data
  • Combine — most real apps use all three strategically per route