Caching: ISR vs SSR
Answered
Greater Flamingo posted this in #help-forum
Greater FlamingoOP
Trying to wrap head around caching concept difference between ISR and SSR. Like if we can cache whole route w/ SSR and revalidate it with
revalidatePath then what's the relevance of ISR?Answered by B33fb0n3
ISR is incremental static regeneration. It's the actual caching mechanism to update static content without rebuilding the entire site & reduce the server load. SSR is server side rendering. So when using SSR you only render the page on the server. There is nothing cached. When you now add a
dynamic = 'force-static' then it's cached as well. So both end up in the same cache: the route cache29 Replies
@Greater Flamingo Trying to wrap head around caching concept difference between ISR and SSR. Like if we can cache whole route w/ SSR and revalidate it with `revalidatePath` then what's the relevance of ISR?
ISR is incremental static regeneration. It's the actual caching mechanism to update static content without rebuilding the entire site & reduce the server load. SSR is server side rendering. So when using SSR you only render the page on the server. There is nothing cached. When you now add a
dynamic = 'force-static' then it's cached as well. So both end up in the same cache: the route cacheAnswer
Greater FlamingoOP
how about revalidation?
@B33fb0n3 ISR is incremental static regeneration. It's the actual caching mechanism to update static content without rebuilding the entire site & reduce the server load. SSR is server side rendering. So when using SSR you only render the page on the server. There is nothing cached. When you now add a dynamic = 'force-static' then it's cached as well. So both end up in the same cache: the route cache
Greater FlamingoOP
if it endup being same in effect, whats the big deal about ISR
both are the same (because both are in the route cache at the end)
@Greater Flamingo if it endup being same in effect, whats the big deal about ISR
compared to what?
It's not compareable to SSR, because SSR itself is just server side rendering and has nothing to do with caching
It's not compareable to SSR, because SSR itself is just server side rendering and has nothing to do with caching
Greater FlamingoOP
i think in ssr rendering is involved even the data is from cache, but can’t confirm
@Greater Flamingo solved?
Greater FlamingoOP
nope, not satisfied with the answer
@B33fb0n3 compared to what?
It's not compareable to SSR, because SSR itself is just server side *rendering* and has nothing to do with caching
Greater FlamingoOP
SSR has caching mechanism right?
@Greater Flamingo SSR has caching mechanism right?
no, SSR itself is just server side rendering and has nothing to do with caching
Greater FlamingoOP
can we cache and revalidate SSR pages?
with revalidateTag/path?
@Greater Flamingo can we cache and revalidate SSR pages?
it doesn't matter if the page is SSR or CSR. Both of it will be cached inside the full router cache and this can be revalidated for example with revalidateTag/path
Greater FlamingoOP
so a cache hit means no server side rendering for that request?
can u confirm with citations? thanks
@Greater Flamingo so a cache hit means no server side rendering for that request?
as said: SSR stands for Server Side Rendering [(see here)](https://nextjs.org/docs/app/building-your-application/rendering/server-components#how-are-server-components-rendered)
It's the rendering process. Not the caching process. Those two things are two completely different things. rendering != caching.
The result of the SSR page can be cached, yes [(see here)](https://nextjs.org/docs/app/building-your-application/rendering/server-components#static-rendering-default). However: SSR itself has no caching inside of it, because it's the process of rendering the page
It's the rendering process. Not the caching process. Those two things are two completely different things. rendering != caching.
The result of the SSR page can be cached, yes [(see here)](https://nextjs.org/docs/app/building-your-application/rendering/server-components#static-rendering-default). However: SSR itself has no caching inside of it, because it's the process of rendering the page
Greater FlamingoOP
talking about route revalidation and caching of SSR pages
@Greater Flamingo talking about route revalidation and caching of SSR pages
the pages are cached inside the full route cache [(see here)](https://nextjs.org/docs/app/building-your-application/caching#overview). And yes, this cache can be revalidate [(see here)](https://nextjs.org/docs/app/building-your-application/caching#invalidation)
Greater FlamingoOP
so basically static and dynamic pages could be validated both time based and on demand, in effect right?
yea
Greater FlamingoOP
alright, i will have to test these, thanks
@Greater Flamingo alright, i will have to test these, thanks
when will you test it?
Greater FlamingoOP
soon
@Greater Flamingo soon
when is soon? Tell it as absolute time
Greater FlamingoOP
why man?
@Greater Flamingo why man?
because I want to know when I should be active to keep this thread open. This thread will automatically close when there is no activity
Greater FlamingoOP
i'm in no obligation to keep this thread open
@Greater Flamingo i'm in no obligation to keep this thread open
i'm in no obligation to help you in the future again. All the best for your project
Feel free to mark a different message as solution if this isn't the solution