Search code examples
cachingnext.jsvercel

Excessive cache misses on NextJS ISR pages


Our NextJs site uses ISR and each page is set to revalidate after 10 minutes.

I naturally expected that this would mean a maximum of 6 revalidations per page per hour.

But Vercel is reporting between 300 - 600 cache misses for each page per hour per region.

I have encountered something similar with serverless functions where we had the stale-while-validate period set too low, and this let some uncached responses get through.

But in getStaticProps you just have the boolean "revalidate" property. As far as I'm aware, you don't have the option to set stale-while-revalidate

Any suggestions on the discrepancy between expected and actual cache misses?


Solution

  • I raised a support ticket with Vercel and they confirmed that their reports are incorrect. Most stale requests are actually recorded as misses.

    There is currently no ETA for a fix.

    Can't link to a source because it's a Vercel support ticket, but here are some details if you would like to follow this up with Vercel

    Support Case: #00131732

    20 April 2023 at 12:36 - "It looks like STALE responses are not shown in the Monitoring as STALE but MISS, which would explain why you're seeing a lot of MISS instead of either HIT or STALE."

    24 April 2023 at 06:36 - "We've raised a feature request internally for this, and the team will look into this. We have yet to be told the ETA by the team, but we're happy to follow up when we have an update to share."