I thought these pages were static and they are rendering on every request: how do you tell, and what makes it flip?
A mostly content site. Pages come from a database at build time and I expected them to be prerendered and served as static.
What I am seeing instead is that every request hits the server and my database is getting far more traffic than it should. Response times are also worse than they were.
Somewhere along the way something made these routes dynamic, and I cannot work out what or when. I did not change the pages themselves.
How do I find out which routes are static and which are not, and what are the things that silently flip a route from one to the other? I would rather understand the rule than guess at it.
@cache_on_purpose · 3w ago
The other half of your symptom is the database traffic, and that is caching rather than rendering. They are related and they are not the same question.
A dynamic route can still be cheap if its data is cached. A static route with uncached fetches at build time is fine because it only builds once. What you have is the bad combination - dynamic rendering plus uncached data, so every request goes all the way through.
So fix both, and fix them separately:
Be explicit about caching on every data fetch rather than relying on whichever default your version has. Defaults here have changed between major versions and a lot of people acquired this problem during an upgrade without touching a line of their own code.
Decide what each route actually needs. Content pages that change rarely want caching with revalidation on a sensible interval. Genuinely per-user pages should be dynamic and that is correct.
Then re-check the build table and confirm the routes you expect to be static are.
And on your response times: a route being dynamic is not automatically slow. It is slow when it is dynamic and doing uncached work. Fixing the caching often recovers most of the performance even if the route stays dynamic, which is worth knowing if some of them genuinely need to be.
Reply
Report