Cache text only static badges for longer #10403
Merged
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.
We serve a lot of static badges.
static_badge
is the single most popular badge on shields. Depending on the time of day it accounts for 10-15% of the traffic we serve from the origin (i.e: uncached). They are the least computationally expensive badges to serve, but there are a lot of them. Each one uses a connection, costs us some egress bandwidth, etcIn general, these badges don't really change.
today is
tomorrow.
We already serve these with quite a long cache on them (1 day), but I think we could go longer in some cases. There is a bit of churn of icon updates in simple-icons, so I think badges which use a logo should stay cached for a day, but for static badges that are just text, lets cache them for longer. I don't think we should say "cache forever". At some point, we will fix a font rendering issue or change the default palette or whatever, so I do want these things to expire after some interval. However, I think we can usefully make that interval longer than a day and meaningfully increase the number of requests served from the CDN instead of the origin.