Repository navigation
Reduce caching duration for low zoom tiles to match actual rerender schedule - #876
Merged
Merged
Conversation
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The HTTP caching for tiles is 6 days for Z0-Z9 and 1 day for Z10-Z13.
Since 6410e8b, the low zoom render happens every day. But this is mostly a waste because each individual Fastly POP is caching Z0-Z9 for a week. So users don't actually see updated tiles every day.
The original intent we can see here https://github.com/openstreetmap/mod_tile/blob/f19e45388733ee9a3c64e1f878fb8dee4cd05a20/src/mod_tile.c#L597 is that the cache time should align with the rerender schedule. Which makes sense. If it's less, then fastly/browser is refetching the same data. That's not so bad because of the ETag, If-None-Match, fastly returns 304 and doesn't actually send the tile. If it's more, then the tileservers are making tiles that won't be seen.
This PR changes the config to match the actual tileserver behavior. For the daily rerender, we'll call that "low zoom" and cache it for 1 day. Mid zoom is an arbitrary distinction, it doesn't need to exist, but I left it just for clarity. High zoom stays unchanged. The HTTP caching becomes 1 day for Z0-Z13. It was already that for Z10-Z13, so this change only affects Z0-Z9, whose tiles only sum up to roughly a gigabyte or maybe less. So the upside of fresh lowzoom tiles is probably worth it I think.