Q67: How does Next.js resolve Race Conditions during concurrent Incremental Static Regeneration (ISR) triggers?

When a stale ISR static page receives concurrent requests from hundreds of users simultaneously, Next.js serves the stale cached page to all incoming users immediately. In the background, Next.js acquires an internal revalidation lock, triggering a single regeneration process. Once complete, the Data and Route caches update atomically for subsequent requests.

Key Takeaways
  • Serves stale cached HTML to concurrent users immediately during background re-generation.
  • Uses background lock flags to execute a single re-render pass, preventing origin server overload.
Knowledge Check

What happens when 1,000 concurrent user requests hit a stale ISR page whose revalidate timer has expired?