Skip to content
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

Cache text only static badges for longer #10403

Merged
merged 2 commits into from
Jul 26, 2024

Conversation

chris48s
Copy link
Member

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, etc

In 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.

@chris48s chris48s added the core Server, BaseService, GitHub auth label Jul 24, 2024
Copy link
Contributor

Messages
📖 ✨ Thanks for your contribution to Shields, @chris48s!

Generated by 🚫 dangerJS against 7f7c8be

Copy link
Member

@PyvesB PyvesB left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reasoning makes sense, let's go with this! 👍🏻

@chris48s chris48s added this pull request to the merge queue Jul 26, 2024
Merged via the queue into badges:master with commit 2dc7184 Jul 26, 2024
24 checks passed
@chris48s chris48s deleted the cache-static-longer branch July 26, 2024 09:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core Server, BaseService, GitHub auth
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants