-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
Use a CDN #1880
Comments
I have been pleasantly surprised at how much impact we've seen from camo's and other caches. I'd of course like to shorten the expiry time a bit so users see fresh results (e.g. for tests and when new versions are published), though we could also lengthen it for badges like license and static badges which rarely change. Another option to consider, as we consider my proposal to move to a PaaS, is the Zeit CDN. It's Cloudflare under the hood, but it's tightly integrated into Zeit. It would be free to us. The person I've spoken with at Zeit says the CDN would be a really effective for our application, and also conveyed that, while we can put Zeit behind our own Cloudflare, we lose the benefits of their integration like automatic flushing on deploys. In the meantime, turning on caching in our Cloudflare makes sense to me. I believe our Cloudflare account is not dedicated to Shields, but shared with other services Thaddée runs. I wonder if we can still use their pro plan for free. |
Have been discussing this with @espadrine today. This is turned this on experimentally! |
Can confirm using @chris48s's test that the second
(wait a few seconds)
After waiting a few minutes, if I re-fetch I get a new time on the first request, then the same time on subsequent requests.
Cache headers look good:
Added: I've added additional monitors: |
How to know whether we hit the CloudFlare cache:
Small note that the behavior detailed in this comment from a CloudFlare support engineer has changed as we requested:
|
We're seeing a significant number of requests handled by the CDN. I'd suggest we re-consider the cache headers on the static badges. That would be a good way to drive that number up. That code is in flight in #1802 though the changes are unrelated. Note also that the website https://shields.io/ is no longer going "through" CloudFlare; the DNS is at CloudFlare but points directly to Github Pages. We may see a slight dip in traffic as those numbers are no longer included, though come to think of it, the traffic on the website probably dwarfs the traffic on the badge servers. |
Looks like we've seen a big drop in average response time since this was enabled on Saturday :) Is there any follow-up outstanding on this, or should we close this issue? |
Yea, it seems really stable! Think this can be closed. The follow-up work could be tracked elsewhere:
|
Since we started setting
cache-control
headers, our badges are now cached by GitHub's camo proxy when badges are viewed on GitHub and in the user's browser when viewed directly. This has given us a noticeable step forward in performance.Some significant proportion of our traffic goes through GitHub's camo proxy but a lot of traffic comes from sources such as NPM, PyPI, Packagist etc which don't independently proxy requests.
We can see by making requests to https://img.shields.io/servertime.svg using a client which does not cache (e.g:
curl
) that these direct requests aren't being cached by CloudFlare.Truncated example:
By using a CDN, this would probably allow us to make another similar step forward in performance similar to the one we've just made by further reducing the number of requests made for badges relating to popular projects.
One option would be CloudFlare. I think we are currently on a free CloudFlare account, but if we mail
[email protected]
with details of the project they offer to upgrade qualifying Open Source projects using their service to a pro plan for free (see https://blog.cloudflare.com/cloudflare-open-source-your-upgrade-is-on-the-house/ ). This would allow us to use them as a CDN.So far:
__cfduid
cookie (related reading: https://community.cloudflare.com/t/disable-cfduid-cookie-for-eu-law-compliance/19323 , https://support.cloudflare.com/hc/en-us/articles/200170156-What-does-the-Cloudflare-cfduid-cookie-do- ) we currently serve this cookie to all users anyway as a consequence of using CF for SSL certs.Given the impact we've seen from some badges being cached by camo I think its worth trying to re-open the conversation around this as there is a lot of potential for positive impact on users. If we're concerned about CF's use of cookies, are the other solutions we could consider here?
The text was updated successfully, but these errors were encountered: