Incremental Static Regeneration is available on all plans
Incremental Static Regeneration (ISR) allows you to create or update content without redeploying your site. ISR has three main benefits for developers: better performance, improved security, and faster build times.
- Better Performance: Static pages can be consistently fast by caching generated pages in every region on Vercel's Edge Network and persisting files into durable storage
- Improved Security: ISR Render Functions are used to generate pages and do not have access to the incoming
request, which prevents accidental caching of user data for increased security
- Faster Builds: Pages can defer generation on request or through an API instead of during the build, helping keep build times fast as your application grows
When you deploy a Next.js application (or a custom solution with the Build Output API), you can define an ISR Render Function which is able to create or update a static page.
Next.js will automatically create an ISR Render Function on Vercel when you use
revalidate. When using the Build Output API, this is called a Prerender Function. These functions do not have access to the incoming
request, which prevents accidental caching of user data for increased security.
Both ISR and
Cache-Control headers (including
stale-with-error) help reduce backend load by making fewer requests to your data source. However, there are key architectural differences between the two.
- Shared Global Cache: The cache for the ISR Render Function output is distributed globally. In the case of a cache
MISS, it looks up the value in a single, global bucket. This means ISR has cache shielding built-in automatically, which helps improve the cache
HITratio. With only
cache-controlheaders, caches expire (by design) and are not shared across regions
- 300ms Global Purges: When a regeneration is triggered (either on-demand or in the background), the ISR Render Function is re-run, and all regions globally are brought up to date with the newest content within 300 ms
- Instant Rollbacks: ISR will persist your generated pages between deployments. This means you are able to roll back instantly and not lose your previously generated pages
ISR abstracts common issues with HTTP-based caching implementations, adds additional features for availability and global performance, and provides a better developer experience for implementation.