-
Notifications
You must be signed in to change notification settings - Fork 41
docs(cloudflare): perf tips #185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for this! This is really useful especially the options to pass to Next.js to ensure it is not minified. One thing that I think might be valuable to the average developer is clarifying when incremental cache vs the tag cache is used (for example when caching with unstable_cache where would my cache actually be saved - in the incremental cache or the tag cache). I think it would probably help developers to understand whether they need a tag cache vs just utilising an incremental cache. We're currently using KV since we are not too bothered about consistency across replicas for our needs. Are there any pitfalls other than this when using KV? |
Co-authored-by: khuezy <[email protected]>
Co-authored-by: khuezy <[email protected]>
Good point, we should clarify this. The incremental cache is the cache store, it contains pages, fetched data, and |
Co-authored-by: James Anderson <[email protected]>
Co-authored-by: James Anderson <[email protected]>
Co-authored-by: James Anderson <[email protected]>
Thanks @anonrig @khuezy @james-elicx @imconnorngl for the review and fixes! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just a few nits/question and probably things to address in a different PR
|
||
The Incremental cache is the store containing all the cached data (i.e. pages, `fetch`, `unstable_cache`). | ||
|
||
You should use the Workers Static Assets based cache if your site is SSG. It is the fastest available option. Note that as Workers Static Assets are read-only, this option can not be used with revalidation. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could add a note about the data cache here, you could use static assets if you only have SSG route (that you don't revalidate) and SSR route with absolutely no data cache (or one that don't change after build).
If they use that they should also not use the tag cache
|
||
It should be configured for App-Router based app using `revalidateTag` or `revalidatePath`. | ||
|
||
The D1 based tag cache should only be used if your site receives low traffic. The Durable Object based tag cache is the recommend option for most sites. See [the reference guide](/cloudflare/caching#tag-cache-for-on-demand-revalidation) for the available configuration options. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should we say low traffic ? Do we want to add some numbers here ? I feel like a lot of people just testing OpenNext should use D1
And I think that a lot of people actually have low enough traffic for D1, D1 is still pretty capable
It should be configured for App-Router based app using `revalidateTag` or `revalidatePath`. | ||
|
||
The D1 based tag cache should only be used if your site receives low traffic. The Durable Object based tag cache is the recommend option for most sites. See [the reference guide](/cloudflare/caching#tag-cache-for-on-demand-revalidation) for the available configuration options. | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should definitely add some notes here about the DO tag cache around the sizing of it, a lot of people issues with that is probably about bad sizing actually. Maybe in another PR, because it is a big subject
Co-authored-by: conico974 <[email protected]>
Thanks for the review @conico974 |
See opennextjs/opennextjs-cloudflare#653