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

Support for caching #274

Open
di opened this issue Dec 6, 2021 · 6 comments
Open

Support for caching #274

di opened this issue Dec 6, 2021 · 6 comments
Labels
api API-related infrastructure backlog Important but currently unprioritized enhancement New feature or request infra infrastructure bugs/FRs

Comments

@di
Copy link
Member

di commented Dec 6, 2021

Other vulnerability APIs such as PyPI's JSON API provide support for caching, allowing the client to avoid making multiple identical requests via ETag headers.

The OSV API's use of POST requests makes this somewhat challenging, as POST responses are not usually cached.

How should OSV support caching, and how should OSV clients cache responses?

@oliverchang oliverchang added the infra infrastructure bugs/FRs label Jul 6, 2022
@andrewpollock andrewpollock added the enhancement New feature or request label Oct 18, 2022
@oliverchang
Copy link
Collaborator

oliverchang commented Jun 6, 2023

We had another similar FR from another party.

My understanding of the relevant HTTP headers is weak, but my understanding is we could leverage two potential headers:

As @di mentioned though, POST may make this a slight misuse of these headers.

As for implementing them, I'm not sure if this is something ESPv2 woulds support today, so it may be a little challenging.

@oliverchang
Copy link
Collaborator

One other consideration here is that caching is not going to be saving much time with the actual query itself -- OSV.dev will still need to compute the actual query before any ETags or similar are returned. This would only save traffic and the costs associated with that.

@di
Copy link
Member Author

di commented Jun 6, 2023

One other consideration here is that caching is not going to be saving much time with the actual query itself -- OSV.dev will still need to compute the actual query before any ETags or similar are returned. This would only save traffic and the costs associated with that.

I'm not sure this is true. If OSV were cached behind a CDN, the CDN could return the same response with the same ETags until OSV determined that the underlying data was changed and issued a purge to invalidate the cache -- only then would another query need to be computed on the next request for a given response.

As @di mentioned though, POST may make this a slight misuse of these headers.

Yeah, I don't think this is a good path to go down. Maybe a better question: why is this a POST request? Could we transition to an API that supports GET requests instead?

@andrewpollock
Copy link
Contributor

Caching was touched on in #2239 as well.

Copy link

This issue has not had any activity for 60 days and will be automatically closed in two weeks

See https://github.com/google/osv.dev/blob/master/CONTRIBUTING.md for how to contribute a PR if you're interested in helping out.

@github-actions github-actions bot added the stale The issue or PR is stale and pending automated closure label Sep 15, 2024
@oliverchang oliverchang added backlog Important but currently unprioritized and removed stale The issue or PR is stale and pending automated closure labels Sep 17, 2024
@oliverchang
Copy link
Collaborator

Leaving this as a backlog item as we don't see this as enough of a priority to justify the large engineering investment here. Please comment here if anybody disagrees!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api API-related infrastructure backlog Important but currently unprioritized enhancement New feature or request infra infrastructure bugs/FRs
Projects
None yet
Development

No branches or pull requests

3 participants