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

caching strategy #67

Open
robjtede opened this issue Oct 5, 2020 · 2 comments
Open

caching strategy #67

robjtede opened this issue Oct 5, 2020 · 2 comments
Labels
general-discussion General discussion issues

Comments

@robjtede
Copy link
Member

robjtede commented Oct 5, 2020

Related to #66 but covers overall caching policies instead of details about just cargo index caching.

We need to consider what our stale-ness tolerance is, especially for the SVG badges (worst case), since I gather than plan will be running a caching CDN in-front of the service. The maximum staleness time will always be the sum of all cache TTLs.

I think ideally, it should be no longer than 1 minute from the time the live crates index is updated to the time a badge is updated.

An sample proposal:

Cargo index cache update time:          20 seconds
Crate query (from cached index) TTL:	10 seconds
SVG Max-Age / CDN TTL:                  30 seconds
==================================================
Total (worst case update time):         60 seconds
@Feliix42 Feliix42 added the general-discussion General discussion issues label Oct 5, 2020
@Feliix42
Copy link
Member

Feliix42 commented Oct 5, 2020

Thanks for the write-up! Looks like a good approach to me. I guess one minute is a good goal, because otherwise we strain the server more than necessary.
In theory, it would be nice if we could ensure that error badges are not cached, but that may be too much overhead and is not worth it with a cache time of max. 1 minute.

@paolobarbolini
Copy link
Member

In theory, it would be nice if we could ensure that error badges are not cached, but that may be too much overhead and is not worth it with a cache time of max. 1 minute.

The Cache-Control header would get set by us dynamically for every response, so that shouldn't be an issue.

Total (worst case update time): 60 seconds

It would be more like 90 seconds for GitHub users, since they proxy every external image through their reverse proxy

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
general-discussion General discussion issues
Projects
None yet
Development

No branches or pull requests

3 participants