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

Big Kahuna: Do cache fills synchronously #290

Closed
arschles opened this issue Jul 17, 2018 · 4 comments
Closed

Big Kahuna: Do cache fills synchronously #290

arschles opened this issue Jul 17, 2018 · 4 comments
Labels
proposal A proposal for discussion and possibly a vote proxy Work to do on the module proxy

Comments

@arschles
Copy link
Member

arschles commented Jul 17, 2018

We've had some discussion about whether to do cache fills synchronously or asynchronously. We've discussed how we can make a vgo get call still succeed if we do cache fills asynchronously (and return a 404 to the user), and created golang/go#26334 to discuss a possibility.

I've mostly argued for asynchronously filling caches until now, but I'm changing my mind because I think doing so makes the CLI (vgo, soon to be Go modules in 1.11), the architecture, and the conceptual model of both the registry and the proxy easier to grasp.

Here's exactly what I'm suggesting on the servers:

  • For a cache miss on a GET /list request, we return only the tags from the upstream. No fetching go.mod or other assets
    • In the registry, "the upstream" means the VCS
    • In the proxy, "the upstream" means the VCS or the registry, or just 404-ing to the client, depending on exclude rules
  • For a cache miss on a /vX.Y.Z.info, vX.Y.Z.info or vX.Y.Z.zip request, we fetch and store all three assets and return the appropriate one

With this machinery in place, the CLI won't need to consider whether to "back off" to the VCS. If it's not in the proxy/registry, it doesn't exist, and that invariant makes golang/go#26334 no longer necessary.

@arschles arschles changed the title Big Kahuna: Big Kahuna: Do cache fills synchronously Jul 17, 2018
@marwan-at-work
Copy link
Contributor

@arschles if you haven't started working on it already, I've already written some of the code for how you described /latest. I can push that as a separate PR.

@arschles arschles added the proposal A proposal for discussion and possibly a vote label Jul 19, 2018
@arschles
Copy link
Member Author

@marwan-at-work I'd love that!

I'm gonna work in increments starting with moving the fetcher logic in #291 and then to putting synchronous fetches into each endpoint, so I'll skip the /list endpoint if you've pushed it up already

@arschles
Copy link
Member Author

arschles commented Jul 20, 2018

We're breaking this up into a few pieces:

Edit #291 is in, but #291, #314 and #316 are closed out, in favor of doing all the cleanup work in #335

@arschles arschles added registry proxy Work to do on the module proxy labels Jul 20, 2018
arschles added a commit to arschles/athens that referenced this issue Jul 20, 2018
This patch shows how we could synchronously fill in storage when the proxy or registry receive a request to '.../version.info' and the package isn't in storage.

Requires gomods#291

Part of gomods#290
@arschles
Copy link
Member Author

arschles commented Jul 20, 2018

Ok right now I have a ton of PRs up that attack this problem, and I've opened some against other branches. Here's how it all looks:

Edit: see #290 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
proposal A proposal for discussion and possibly a vote proxy Work to do on the module proxy
Projects
None yet
Development

No branches or pull requests

2 participants