[GitHub] [trafficserver] mlibbey commented on issue #9939: How to config ATS to refresh cache for files modified on server
mlibbey commented on issue #9939: URL: https://github.com/apache/trafficserver/issues/9939#issuecomment-1620480768 From the above, worst case, the /data/daily* content would be stale for the first hour of the day (eg, if it gets revalidated right before the new content is made. If the production process can't generated uniquely named objects (or in new folder paths; new query strings... something -- versioned objects are definitely the best of best practices) guess should have also noted that Expires: alone may be what you are looking for -- like `"modification plus 24 hours"` (if that's both correct syntax and the files are created exactly 24hrs later), would have the cached copies all go stale at an exact time. - When Expires and Cache-Control headers are both present, Expires is ignored. - Expires alone increases the necessity of keeping the cache node's time correct. - With expires alone, a specific object on all the cache nodes' will go stale at the same time -- which can mean a thundering herd of requests. - if the production process stops the 'yet to be produced' objects will be continuously stale, and origin requests would increase for that time period. For instance, if the /data/daily/imageoftheday.jpg expires 24hrs after being made, and it actually gets produced 26hrs later, you'd have 2 hours of requests to the cache nodes resulting in proxying to the origin for updated content. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@trafficserver.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org
[GitHub] [trafficserver] mlibbey commented on issue #9939: How to config ATS to refresh cache for files modified on server
mlibbey commented on issue #9939: URL: https://github.com/apache/trafficserver/issues/9939#issuecomment-1615999358 Guess a few best practices: - Have the origin version assets when changed -- query strings; checksums in the path... something that makes the new content get a unique cache key. That way, new content is fetched once users start requesting it. - Have the origin set the Cache-Control header instead of using cache.config to define the cache policy. - If versioning is not possible, have the origin set the max-age to how fast they need the new content to appear -- noting that shorter max-age times means more load on origin (and more frequent slower user experience). For example for daily content, they would be ok with content showing up within an hour after publishing -- then set max-age=3600. You can purge individual objects with the PURGE method -- eg, curl -XPURGE "http://example.com/foo.jpg;. You could also invalidate the entire cache for a remap rule via the [proxy.config.http.cache.generation]( https://docs.trafficserver.apache.org/admin-guide/files/records.config.en.html#proxy-config-http-cache-generation) setting override. There is also a [Regex Revalidation Plugin](https://docs.trafficserver.apache.org/admin-guide/plugins/regex_revalidate.en.html) where you give a list of regexes to invalidate on the next request. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@trafficserver.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org