HomeBlogServer-Side Rendering vs Static Site Generation:...

Engineering Guide · 8 min read · July 21, 2026

Server-Side Rendering vs Static Site Generation: Performance Explained

Choosing between SSR and SSG is really a question of where your cache boundary lives. Here is how each rendering mode affects TTFB, Core Web Vitals, database load, and deployment complexity—and when hybrid caching patterns outperform both.

Author
Smit Desai
Published
July 21, 2026
Read time
8 min read
Topic
Full-Stack Web
Services
Custom Web · Mobile Apps · All Services

Every time a team rebuilds a storefront, media portal, or SaaS web app, the rendering debate surfaces: should we go all-in on Static Site Generation (SSG) for speed, or Server-Side Rendering (SSR) for dynamic data?

Most comparisons frame this as a framework choice between Next.js, Astro, Laravel, or Nuxt. In production, rendering is not an ideological choice—it is a cache invalidation and compute placement decision. Put your HTML generation in the wrong place, and you either wait 45 minutes for builds to finish or hammer your primary database on every anonymous bot crawl.


Where Time Actually Goes in a Page Load

To evaluate SSR versus SSG objectively, split user-perceived performance into the stages tracked by Google Core Web Vitals:

  • Time to First Byte (TTFB): How long the browser waits after sending a request before byte #1 of HTML arrives. CDN edge cache hits take 20–60ms; uncached database-backed SSR often takes 250–900ms.
  • Largest Contentful Paint (LCP): When the main headline or hero image finishes painting. Both SSG and fast SSR deliver immediate HTML so the browser discovers hero images on the first pass, unlike Client-Side Rendering (CSR) where the browser must download, parse, and execute a JavaScript bundle before even requesting page data.
  • Interaction to Next Paint (INP): How fast the UI responds to clicks. Heavy JavaScript hydration hurts both SSR and SSG equally if you ship megabytes of unused client JS to mid-range phones.

Notice that the biggest real-world gap between SSR and SSG sits almost entirely inside TTFB and server resilience under traffic spikes.


How SSR, SSG, and Hybrid Caching Compare

Rendering Strategy Where HTML Builds Typical Edge TTFB Data Freshness Infra & Scaling Bottleneck Ideal Fit
Client-Side (CSR) User's browser 30–80ms (empty shell) Live via API Slow LCP on mobile; weak SEO Logged-in dashboards, internal tools
Static Site Gen (SSG) CI/CD build step 15–50ms (CDN edge) Stale until next deploy Build time explodes past ~5k pages Docs, landing pages, marketing sites
Uncached SSR Origin server per request 200–800ms+ Real-time per user DB & CPU scale linearly with traffic Auth portals, live checkout, personalized feeds
ISR / Edge-Cached SSR Origin on miss, cached at CDN 20–70ms (cache hit) Bounded (e.g., 60s–5m) Cache invalidation logic E-commerce catalogs, news, SaaS blogs

Why Pure SSG Breaks on Growing Catalogs

SSG feels magical at launch: compile Markdown and product JSON during npm run build, push flat files to Cloudflare or Vercel, and watch TTFB drop below 40ms worldwide.

The cracks appear when business operations scale:

  1. Build duration creeps up: Rendering 20,000 localized product pages in CI easily stretches deploys to 25–40 minutes. A typo fix in the header waits behind a full catalog rebuild.
  2. Dynamic inventory lies to buyers: If an item sells out three minutes after your last build, static HTML keeps showing "In Stock" until the next deploy or a client-side hydration flash overwrites it—creating jarring layout shifts (CLS).
  3. Personalization forces client waterfalls: Currency switching, B2B contract pricing, and logged-in navigation cannot be pre-baked per user into one static file.

Why Uncached SSR Hurts Latency and Cloud Bills

Teams burned by slow static builds often swing hard to the opposite extreme: rendering every route dynamically on the server on every single request.

Without caching in front of SSR, a viral social post or aggressive scraper triggers thousands of identical SQL queries per minute for the exact same public homepage. Even if a page only changes twice a day, your origin servers burn CPU reconstructing identical DOM trees over and over.

Having managed 300+ WordPress sites at server level for a Finnish partner, I have seen firsthand how fragile uncached origin rendering is: a single unoptimized query inside a page template turns a modest traffic spike into 502 timeouts, whereas placing proper edge or FastCGI micro-caching in front of the exact same backend drops server CPU by an order of magnitude.


The Practical Winner: Edge-Cached SSR and ISR

For most public-facing commercial apps, neither pure build-time SSG nor raw uncached SSR is optimal. You want on-demand server rendering paired with short-lived CDN caching, implemented either via framework Incremental Static Regeneration (ISR) or standard HTTP Cache-Control headers.

Consider how clean stale-while-revalidate is at the HTTP layer—no proprietary build magic required:

HTTP/1.1 200 OK
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=0, s-maxage=120, stale-while-revalidate=600
Vary: Accept-Encoding

Here is what those directives tell a CDN (Cloudflare, Fastly, CloudFront, or Vercel's edge network described on the Vercel engineering blog):

  • max-age=0: Browsers always revalidate with the CDN so you never trap users on stale local copies.
  • s-maxage=120: The CDN serves the cached HTML directly from the nearest edge node for 2 minutes with zero origin hits.
  • stale-while-revalidate=600: Between minute 2 and minute 12, the CDN still serves the cached copy instantaneously to the visitor while asynchronously refreshing the page from your origin in the background.

Users see SSG-level speed (under 50ms TTFB), marketing teams see updates within two minutes without waiting on CI rebuilds, and your database only renders each popular URL once every few minutes regardless of traffic volume.

Mixing Static Shells With Live Data Safely

What about pages that are 95% public and 5% personalized—like a store header showing cart count or a pricing page showing local currency?

  • Option A — Streaming SSR / Partial Islands: Serve the static product body immediately from edge cache and stream or fetch only the tiny user-specific fragment (/api/cart/summary) asynchronously.
  • Option B — Edge Cookie Routing: Use Vary carefully or evaluate lightweight edge middleware only for country/currency buckets (USD, EUR, GBP) rather than busting cache per individual user ID.

Never put Set-Cookie on public cacheable responses—most CDNs automatically bypass caching whenever an origin response sets a session cookie.


How to Decide for Your Next Build

Keep your rendering rules simple enough that every engineer on the team knows where cache invalidation lives:

  1. Marketing pages, docs, blogs: Use SSG or edge-cached SSR with long s-maxage and webhook purge on publish.
  2. Product catalogs, directories, listings: Use ISR or s-maxage + stale-while-revalidate, keeping volatile stock/price badges fetched via lightweight endpoints if accuracy to the second matters.
  3. Authenticated dashboards & internal workflows: Skip SSG completely. Focus on indexed SQL queries, clean API payloads, and keeping JavaScript bundle sizes lean.

Understanding how an embedded engineer tunes the full stack—from SQL indexes up to CDN headers—often matters more than switching frameworks; see our comparison of a Forward Deployed Engineer vs Full Stack Developer for how that operational mindset works in practice.


Let SmitDev Audit or Build Your Web Architecture

Slow TTFB, bloated JavaScript bundles, and misconfigured CDN headers quietly cost businesses conversions and organic search visibility every day. Across 170+ shipped case studies—from $399 7-day business websites built for clean Core Web Vitals to complex custom web application development stacks handling international traffic—I tune rendering pipelines from database query plans right up to edge cache policies.

Want an honest performance audit or a fast, SEO-ready web application built without agency bloat? Contact me here to discuss your site speed goals and architecture.

Written by Smit Desai · Principal Full-Stack & FDSE

8+ years shipping production systems · 171 case studies · 300+ WordPress servers managed for Finland partners.

Next Steps and Recommended Resources

Next Steps · Recommended Resources

Pillar 1 · Custom Web & SaaS

Custom Web Application Development

Production Laravel, Next.js, API, and multi-tenant SaaS systems engineered end to end at $55/day (8–9 hrs) or $1,999/mo.

Comparison · Buyer Guide

SmitDev vs Software Agencies

See side-by-side economics, senior code ownership, and onboarding speed vs traditional dev shops and marketplaces.

01 — Frequently asked questions

full-stack web

Is Static Site Generation always faster than Server-Side Rendering?

On cold first-byte latency (TTFB), pre-built static HTML served from a CDN edge node is nearly unbeatable because zero database queries run per request. However, edge-cached SSR using stale-while-revalidate headers achieves identical CDN speeds for repeat visitors while avoiding multi-hour build pipelines.

When does Static Site Generation stop scaling?

SSG breaks down when your site crosses thousands of frequently changing URLs—such as a 40,000-SKU e-commerce catalog with live stock counts—or when content depends on user authentication, geo-currency, or role permissions.

Does SSR hurt Google Core Web Vitals?

SSR improves Largest Contentful Paint (LCP) compared to client-side SPAs because browsers receive complete HTML immediately. It only hurts Core Web Vitals when slow backend database queries push Time to First Byte (TTFB) above 600–800ms or when massive JavaScript bundles block hydration (INP).

What is the best rendering strategy for a B2B SaaS marketing site plus logged-in app?

Keep marketing pages, docs, and blog routes static or edge-cached so they load under 100ms globally for SEO, while serving the authenticated application via fast server-rendered templates or a split SPA shell backed by indexed APIs.

03 — Have an engineering need?

hire the right expertise

Let's talk tech.

Deciding between an embedded forward deployed engineer or a senior full stack developer? Share your technical context and timeline.

Solitaire Corporate Park, Makarba, Ahmedabad, Gujarat 380015, India · IST (UTC+5:30) · --:-- IST · Mon–Fri 09:00–18:00 IST · US & EU overlap daily

No newsletter, no CRM. Just a reply.