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

Re: Multi-threaded 'git clone'

From
Jeff King <peff@peff.net>
Date
Feb 16, 2015, 15:47 UTC
Message-ID
<20150216154745.GA10120@peff.net>
In-Reply-To
<alpine.DEB.2.02.1502160727480.23770@nftneq.ynat.uz>
On Mon, Feb 16, 2015 at 07:31:33AM -0800, David Lang wrote:
Show 10 quoted lines
> >Then the server streams the data to the client. It might do some light
> >work transforming the data as it comes off the disk, but most of it is
> >just blitted straight from disk, and the network is the bottleneck.
> 
> Depending on how close to full the WAN link is, it may be possible to
> improve this with multiple connections (again, referencing bbcp), but
> there's also the question of if it's worth trying to use the entire WAN for
> a single user. The vast majority of the time the server is doing more than
> one thing and would rather let any individual user wait a bit and service
> the other users.

Yeah, I have seen clients that make multiple TCP connections to each request a chunk of a file in parallel. The short answer is that this is going to be very hard with git. Each clone generates the pack on the fly based on what's on disk and streams it out. It should _usually_ be the same, but there's nothing to guarantee byte-for-byte equality between invocations. So you'd have to multiplex all of the connections into the same server process. And even then it's hard; that process knows its going to send you byte the bytes for object X, but it doesn't know at exactly which offset until it gets there, which makes sending things out of order tricky. And the whole output is checksummed by a single sha1 over the whole stream that comes at the end.

I think the most feasible thing would be to quickly spool it to a server on the LAN, and then use an existing fetch-in-parallel tool to grab it from there over the WAN.

-Peff
Previous: David LangNext: Junio C Hamano
Message 5 of 9 in “Multi-threaded 'git clone'”
  1. Koosha KhajehmoogahiFeb 16, 2015
  2. David LangFeb 16, 2015
  3. Jeff KingFeb 16, 2015
  4. David LangFeb 16, 2015
  5. Jeff KingFeb 16, 2015
  6. Junio C HamanoFeb 16, 2015
  7. Shawn PearceFeb 17, 2015
  8. Duy NguyenFeb 16, 2015
  9. Jeff KingFeb 17, 2015

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.