Disk cache dimension with 150k static pages #62085
Replies: 3 comments
-
Ok thanks
Le jeu. 15 févr. 2024, 10:26, Francesco Bonizzi ***@***.***>
a écrit :
… Summary
We are currently hosting a NextJs website on a Linux Azure WebApp. It's a
recipes website (if you need to look it, it's here
<https://ricette.tuduu.it>). We aren't using App Router.
Our biggest route is /pages/[slug]/index.tsx, here we generate at build
time 200 pages, then we let the server generate other routes content on
demand, then cache them (fallback: blocking). The problem is that with so
many pages (more than 150k) after two weeks the WebApp storage is filled
with more than 20Gb of cached pages - I navigated the WebApp, everything is
in .next/server/pages folder. With this kind of size, our deploy task (
***@***.***) hangs a lot and usually timeouts (I really
don't know way, but empirically that's the reason), so we need to fill less
space.
The ideal solution could be to conditionally cache on disk some pages, for
example I would keep in cache the build time generated pages and a bunch of
other pages (for example all the recipes created in the last month only,
since we have creators that are always creating new contents). But it
doesn't seem possible.
Do you have any other ideas? Is there something we could do better?
Thanks.
Additional information
(Development machine)
Operating System:
Platform: darwin
Arch: arm64
Version: Darwin Kernel Version 23.2.0: Wed Nov 15 21:53:34 PST 2023; root:xnu-10002.61.3~2/RELEASE_ARM64_T8103
Binaries:
Node: 21.1.0
npm: 10.2.0
Yarn: 1.22.19
pnpm: 8.15.2
Relevant Packages:
next: 14.1.0
eslint-config-next: 14.1.0
react: 18.2.0
react-dom: 18.2.0
typescript: 5.3.3Next.js Config:
output: N/A
Example
*No response*
—
Reply to this email directly, view it on GitHub
<#62085>, or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ATQKX2MSYUATWZBSYZZLDSLYTXPG3AVCNFSM6AAAAABDJ7KV7WVHI2DSMVQWIX3LMV43ERDJONRXK43TNFXW4OZWGIZDCMRQGE>
.
You are receiving this because you are subscribed to this thread.Message
ID: ***@***.***>
|
Beta Was this translation helpful? Give feedback.
-
There are several caching strategies you can use to control the number of pages you have: First of all, configuration-caching for next.js should give you custom control over your web cache, if you need more fine-grained control you may want to custom-server Strategy 1: Strategy 2: example:
|
Beta Was this translation helpful? Give feedback.
-
Summary
We are currently hosting a NextJs website on a Linux Azure WebApp. It's a recipes website (if you need to look it, it's here). We aren't using App Router.
Our biggest route is
/pages/[slug]/index.tsx
, here we generate at build time 200 pages, then we let the server generate other routes content on demand, then cache them (fallback: blocking
). The problem is that with so many pages (more than 150k) after two weeks the WebApp storage is filled with more than 20Gb of cached pages - I navigated the WebApp, everything is in.next/server/pages
folder. With this kind of size, our deploy task (AzureRmWebAppDeployment@4
) hangs a lot and usually timeouts (I really don't know way, but empirically that's the reason), so we need to fill less space.The ideal solution could be to conditionally cache on disk some pages, for example I would keep in cache the build time generated pages and a bunch of other pages (for example all the recipes created in the last month only, since we have creators that are always creating new contents). But it doesn't seem possible.
Do you have any other ideas? Is there something we could do better?
Thanks.
Additional information
Example
No response
Beta Was this translation helpful? Give feedback.
All reactions