Why isn't serve stale working as expected?



  • Ilya Kaplan

    Hi, It's not clear if setting TTL to >3700 is absolute MUST in order for stale to work, or it just lowers the probability of having it cached long after TTL ends.

    Can you explain how exactly it will work, if I set TTL to 10m and staleiferror to 30d, and then origin goes down for few hours? I'd guess it depends on when the object was last accessed (and thus refreshed). So 3 cases: 1. Last user accessed it minute ago - object still within TTL. 2. Last user accessed it 11 minutes ago - object just passed TTL. 3. Last user accessed it week ago - object long ago passed the TTL, but still within staleiferror time.


  • Ilya Kaplan

    Do you plan on changing this functionality in future? For example, write object to disk if it's need to be thrown out of memory but it still has grace period.

    It seems to me, that the case that I mentioned in example, is highly used case, where page is cached with some reasonable refresh rate, 10m-1h, less than 3700, but still with desire to server stale in case of errors.

  • Amanda Fuhrmann

    Hey Ilya,

    At this time, we have no plans on changing the setup. An object with a low TTL is one that needs to be refreshed constantly (whether or not the object is changing), and isn't suited for being stored on SSD.

    If you have an object that isn't being accessed very often, and doesn't change so much that a synthetic error page wouldn't be preferable to the stale object, then I would recommend increasing the standard TTL, and using our soft purge feature when the object does change (I specify soft purging so that you maintain your Stale cache in case of error).

    Best, Amanda

Please sign in to leave a comment.