git/list[1] front-page[2] threads[3] people[4] search[5] about
 

Re: [PATCH v2 0/8] CDN offloading of fetch response

From
Jeff King <peff@peff.net>
Date
Apr 23, 2019, 05:21 UTC
Message-ID
<20190423052159.GA12530@sigill.intra.peff.net>
In-Reply-To
<cover.1552073690.git.jonathantanmy@google.com>
On Fri, Mar 08, 2019 at 01:55:12PM -0800, Jonathan Tan wrote:
> Here's my current progress - the only thing that is lacking is more
> tests, maybe, so I think it's ready for review.

A bit belated, but here are some overall thoughts. A lot of my thinking comes from comparing this to previous work I had done on teaching the client to fetch first from a bundle and then do a follow-up fetch from the server.

> This code now starts CDN downloads after closing the first HTTP request,
> and it holds on to the .keep files until after the refs are set. I'll
> leave parallelization of the CDN downloads for later work.

Good. One of the problems with the bundle+followup approach was either having to hold open or re-establish the connection to the original server, since that fetch had to be put on hold.

I agree that parallelizing can come later. I do wonder if it's worth making a new tool rather than trying to reuse git-http-fetch. Yes, it basically does what we want already, but there's quite a lot of cruft in that dumb-http code base. Using http_get_file(), or even curl more directly might be a bit easier.

One problem in particular I'd worry about is that the http code generally expects authentication to happen through the initial ref-discovery, and then be set for all subsequent requests. So I doubt an http_pack_request actually handles auth at all, and retro-fitting it may be tricky.

> One relatively significant change: someone pointed out that the issue fixed by 
> 50d3413740 ("http: make redirects more obvious", 2016-12-06) could also
> occur here, so I have changed it so that the server is required to send
> the packfile's hash along with the URI.

I have mixed feelings on that. I like how it clearly makes the server the source of authority. You don't have to care about CDN tampering, because you know you are getting the bytes the server wanted you to.

I think even without that this is still _mostly_ true, though. You're going to compute the hash of every object the CDN sends you, and those objects must fit into the missing gaps in what the server sends you. So the worst case is that a malicious CDN could send you some extra objects. That's probably not the end of the world, but I do like the extra guarantee of knowing that you got byte-for-byte what the server wanted you to.

Show 12 quoted lines
> This does mean that Ævar's workflow described in [1] would not work.
> Quoting Ævar:
> 
> > More concretely, I'd like to have a setup where a server can just dumbly
> > point to some URL that probably has most of the data, without having any
> > idea what OIDs are in it. So that e.g. some machine entirely
> > disconnected from the server (and with just a regular clone) can
> > continually generating an up-to-date-enough packfile.
> 
> With 50d3413740, it seems to me that it's important for the server to
> know details about the URIs that it points to, so such a disconnection
> would not work.

I think even without 50d3413740, this is important for your scheme. One of the weaknesses (and strengths, I suppose) of the bundle+followup scheme was that the initial bundle generally had to meet the git repository guarantee. After you fetched the bundle, you'd tell the server "OK, now I have commit X" just like you were a regular client.

But I really like that your proposal does away with that, and asks for tighter cooperation between the server and the CDN. It means the CDN can serve some random subset of the objects. But once we do that, now the server _has_ to know what was in those URLs it pointed to, because our protocol has no good way of communicating a random subset of objects (if they're just blobs, we could enumerate all of them to the server as haves; yuck. But as soon as you get a tree or commit from the CDN, you have to have all of the reachable objects to be able to claim it).

So I think this is pretty inherent to your proposal, and but it's the right tradeoff to be making here (I think there could still be room for the other thing, too, but it's just a different feature).

I have a few other comments on the design, but I'll send them in response to patch 5.

-Peff
Previous: Josh SteadmonNext: Jonathan Tan
Message 43 of 45 in “[WIP 0/7] CDN offloading of fetch response”
  1. Jonathan TanFeb 23, 2019
  2. 1/7 http: use --stdin and --keep when downloading packJonathan Tan, Feb 23, 2019
  3. 2/7 http: improve documentation of http_pack_requestJonathan Tan, Feb 23, 2019
  4. 3/7 http-fetch: support fetching packfiles by URLJonathan Tan, Feb 23, 2019
  5. 4/7 Documentation: order protocol v2 sectionsJonathan Tan, Feb 23, 2019
  6. 5/7 Documentation: add Packfile URIs design docJonathan Tan, Feb 23, 2019
  7. 6/7 upload-pack: refactor reading of pack-objects outJonathan Tan, Feb 23, 2019
  8. 7/7 upload-pack: send part of packfile response as uriJonathan Tan, Feb 23, 2019
  9. Junio C HamanoFeb 24, 2019
  10. Christian CouderFeb 25, 2019
  11. Jonathan NiederFeb 26, 2019
  12. Christian CouderFeb 26, 2019
  13. Josh SteadmonMar 1, 2019
  14. Jonathan TanMar 1, 2019
  15. Christian CouderFeb 25, 2019
  16. Jonathan NiederFeb 25, 2019
  17. Christian CouderFeb 26, 2019
  18. Ævar Arnfjörð BjarmasonFeb 26, 2019
  19. Christian CouderMar 4, 2019
  20. Jonathan NiederFeb 28, 2019
  21. Christian CouderMar 4, 2019
  22. 0/8 CDN offloading of fetch responseJonathan Tan, Mar 8, 2019
  23. 1/8 http: use --stdin when getting dumb HTTP packJonathan Tan, Mar 8, 2019
  24. 2/8 http: improve documentation of http_pack_requestJonathan Tan, Mar 8, 2019
  25. 3/8 http-fetch: support fetching packfiles by URLJonathan Tan, Mar 8, 2019
  26. 4/8 Documentation: order protocol v2 sectionsJonathan Tan, Mar 8, 2019
  27. 5/8 Documentation: add Packfile URIs design docJonathan Tan, Mar 8, 2019
  28. Jeff KingApr 23, 2019
  29. Jonathan TanApr 23, 2019
  30. Ævar Arnfjörð BjarmasonApr 23, 2019
  31. Jonathan NiederApr 23, 2019
  32. Ævar Arnfjörð BjarmasonApr 23, 2019
  33. Jonathan NiederApr 23, 2019
  34. Jonathan NiederApr 23, 2019
  35. Ævar Arnfjörð BjarmasonApr 23, 2019
  36. Jonathan NiederApr 23, 2019
  37. Ævar Arnfjörð BjarmasonApr 24, 2019
  38. Junio C HamanoApr 24, 2019
  39. 6/8 upload-pack: refactor reading of pack-objects outJonathan Tan, Mar 8, 2019
  40. 7/8 fetch-pack: support more than one pack lockfileJonathan Tan, Mar 8, 2019
  41. 8/8 upload-pack: send part of packfile response as uriJonathan Tan, Mar 8, 2019
  42. Josh SteadmonMar 19, 2019
  43. Jeff KingApr 23, 2019
  44. Jonathan TanApr 23, 2019
  45. Ævar Arnfjörð BjarmasonApr 24, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.