Course contentsShow
← Web Development
Lesson 1802 of 2,98233. Static Site Generation and JamstackFree lesson

Content Freshness vs Build Time Trade-offs

Balancing how often content updates with build performance and determining optimal revalidation intervals per route.

Content Freshness vs Build Time Trade-offs

You'll learn how to balance content update frequency against build performance and set optimal revalidation intervals for different routes.

The Core Dilemma

With static site generation and ISR, you face a fundamental trade-off: more frequent updates mean more builds or revalidations, which consume resources and time. Set your revalidation interval too short (say, every 10 seconds), and you're essentially rebuilding constantly. Set it too long (24 hours), and users might see stale content.

Think of it like a newspaper: a daily paper is fresh enough for most news, but a stock ticker needs updates every second. Your content has similar requirements—not everything needs the same freshness.

Route-Level Decisions

Different pages have different freshness needs:

  • Homepage: Maybe revalidate every 60 seconds (high visibility, moderate update frequency)
  • Blog posts: Every 3600 seconds/1 hour (content rarely changes after publishing)
  • Product inventory: Every 300 seconds/5 minutes (balance between freshness and server load)
  • About page: Every 86400 seconds/24 hours (rarely changes)
// Example conceptual configuration
export async function getStaticProps() {
  return {
    props: { data },
    revalidate: 3600 // 1 hour - matches content update pattern
  }
}

Finding the Sweet Spot

Ask yourself:

  1. How often does this content actually change? (Reality check)
  2. How stale can users tolerate it being? (User impact)
  3. What's the cost of rebuilding? (Resource consideration)

A blog post from 2020 doesn't need revalidation every minute. Breaking news might need it every 30 seconds.

Key Takeaway: Optimize revalidation intervals per route based on actual content update frequency and user tolerance for staleness—frequent revalidation isn't always better, it's about matching your content's natural rhythm.