-
-
Notifications
You must be signed in to change notification settings - Fork 127
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add cache purge step to CI deploy stage #533
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lgtm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Joe is the best programmer in the world
Is there a smarter way to clear invalidated cache items rather than purging the whole thing? Not sure if that even make sense with the way they store cache, but I don't know how they do that. |
@MarkKoz If you pay Cloudflare, you can pass a list of wildcards to invalidate. We could pass a list of individual file URLs but it's unnecessary complexity. It's better to just have pages have a slightly higher initial load time (which assets already do – considering we currently serve django pages with no cache other than for static assets). Below graph shows HTTP reqs to our server from clients in US, HK & UK. Start of graph is serving from our servers, so responses range from 300ms to 1.2s, so worst case scenario for each Cloudflare PoP that has no cached copy someones request takes up to that duration. End of this graph shows serving from the Cloudflare PoPs, which makes site response times considerably faster, consistently sub-100ms. |
Better in terms of what, just reduced complexity? Anyway a max of 1.2s for a few unlucky people sounds acceptable. |
Yeah, that's all. The process for conditional invalidation would be along the lines of getting a diff of files changed, mapping that to URLs and then pushing that to Cloudflare, it's possible but is another component to maintain. We'd need to build static assets, reverse all the resource and guide URLs and so on, which is possible but I'm not sure it's worth it. |
I want to serve site from the edge, since the content there is primarily static. This PR ensures that cached content is cleared upon deploy so that we can benefit from high edge cache TTLs while still having new content deploy immediately.