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

Re: Make `git fetch --all` parallel?

From
Stefan Beller <sbeller@google.com>
Date
Oct 12, 2016, 06:47 UTC
Message-ID
<CAGZ79kbvdEUj5JKQX2MJ9THG03Bwfr0nSE5z-VPTmE3H+6TY2g@mail.gmail.com>
In-Reply-To
<20161012015224.g2eb24jexepeewob@sigill.intra.peff.net>
On Tue, Oct 11, 2016 at 6:52 PM, Jeff King <peff@peff.net> wrote:
Show 65 quoted lines
> On Tue, Oct 11, 2016 at 09:34:28PM -0400, Jeff King wrote:
>
>> > Ok, time to present data... Let's assume a degenerate case first:
>> > "up-to-date with all remotes" because that is easy to reproduce.
>> >
>> > I have 14 remotes currently:
>> >
>> > $ time git fetch --all
>> > real 0m18.016s
>> > user 0m2.027s
>> > sys 0m1.235s
>> >
>> > $ time git config --get-regexp remote.*.url |awk '{print $2}' |xargs
>> > -P 14 -I % git fetch %
>> > real 0m5.168s
>> > user 0m2.312s
>> > sys 0m1.167s
>>
>> So first, thank you (and Ævar) for providing real numbers. It's clear
>> that I was talking nonsense.
>>
>> Second, I wonder where all that time is going. Clearly there's an
>> end-to-end latency issue, but I'm not sure where it is. Is it startup
>> time for git-fetch? Is it in getting and processing the ref
>> advertisement from the other side? What I'm wondering is if there are
>> opportunities to speed up the serial case (but nobody really cared
>> before because it doesn't matter unless you're doing 14 of them back to
>> back).
>
> Hmm. I think it really might be just network latency. Here's my fetch
> time:
>
>   $ git config remote.origin.url
>   git://github.com/gitster/git.git
>
>   $ time git fetch origin
>   real    0m0.183s
>   user    0m0.072s
>   sys     0m0.008s
>
> 14 of those in a row shouldn't take more than about 2.5 seconds, which
> is still twice as fast as your parallel case. So what's going on?
>
> One is that I live about a hundred miles from GitHub's data center, and
> my ping time there is ~13ms. The other side of the country, let alone
> Europe, is going to be noticeably slower just for the TCP handshake.
>
> The second is that git:// is really cheap and simple. git-over-ssh is
> over twice as slow:
>
>   $ time git fetch git@github.com:gitster/git
>   ...
>   real    0m0.432s
>   user    0m0.100s
>   sys     0m0.032s
>
> HTTP fares better than I would have thought, but is also slower:
>
>   $ time git fetch https://github.com/gitster/git
>   ...
>   real    0m0.258s
>   user    0m0.080s
>   sys     0m0.032s
>
> -Peff

Well 9/14 are https for me, the rest is git:// Also 9/14 (but a different set) is github, the rest is either internal or kernel.org.

Fetching from github (https) is only 0.9s from here (SF bay area, I'm not in Europe any more ;) )

I would have expected to have a speedup of roughly 2 + latency gains. Factor 2 because in the current state of affairs either the client or the remote is working, i.e. the other sie is idle/waiting, so factor 2 seemed reasonable (and ofc the latency), so I was a bit surprised to see a higher yield.

Previous: Jeff King
Message 12 of 12 in “Make `git fetch --all` parallel?”
  1. Ram RachumOct 11, 2016
  2. Stefan BellerOct 11, 2016
  3. Junio C HamanoOct 11, 2016
  4. Stefan BellerOct 11, 2016
  5. Stefan BellerOct 11, 2016
  6. Junio C HamanoOct 11, 2016
  7. Jeff KingOct 11, 2016
  8. Ævar Arnfjörð BjarmasonOct 11, 2016
  9. Stefan BellerOct 11, 2016
  10. Jeff KingOct 12, 2016
  11. Jeff KingOct 12, 2016
  12. Stefan BellerOct 12, 2016

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.