-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update default cache-control headers
The default cache-control instruction will be: max-age=60, stale-while-revalidate=86400, stale-if-error=300 Each can be overridden individually, leaving the others intact, or each can be set to `None` to remove it. Rationale --- **max-age=60** Hard-cache for a minimal amount of time so content can be easily refreshed. The considerations here are as follows: - To avoid caching headaches, it's best if when people need to refresh a page (e.g. after they've just done a release) they can do so by simply refreshing their browser. - However, it needs to be long enough to protect our applications from excessive requests from all the pages being generated (a factor) 1 minute seems like a good compromise. **stale-while-revalidate=86400** stale-while-revalidate defines a period after the cache has expired (max-age) during which users will get sent the stale cache, while the cache updates in the background. This mean that users will continue to get speedy (potentially stale) responses even if the refreshing of the cache takes a while, but the content should still be no more than a few seconds out of date. We want this to be pretty long, so users will still get a quick response (while triggering a background update) for as long as possible after the cache has expired. An additional day will hopefully be long enough for most cases. **stale-if-error=300** stale-if-error defines a period of time during which a stale cache will be served back to the client if the cache observes an error code response (>=500) from the backend. When the cache receives a request for an erroring page, after serving the stale page it will ping off a background request to attempt the revalidate the page, as long as it's not currently waiting for a response. We set this value to protect us from transitory errors. The trade-off here is that we may also be masking errors from ourselves. While we have Sentry and Greylog to potentially alert us, we might miss these alerts, which could lead to much more serious issues (e.g. bringing down the whole site). The most clear manifestation of these error would be simply an error on the site. So we set this to 5 minutes following expiry as a trade-off.
- Loading branch information
Showing
4 changed files
with
153 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
#! /usr/bin/env python3 | ||
|
||
from setuptools import setup, find_packages | ||
|
||
setup( | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters