Repository navigation
Description
Goal
Improve the speed at which Git LFS performs checkouts with a majority of
uncached objects.
Background
Late last year, we added support for the new process filter, added in Git
v2.11.0, as a means to convert files during check-in/out operations. This
greatly improved the performance of both operations, most notably on Windows,
where the overhead of spawning git-lfs-clean(1) or git-lfs-smudge(1) for
each file in the operation incurred significant overhead. (See:
#1329 (comment)).
We noted, however, that this protocol (as is the case with 'smudge' and 'clean'
filters) has an opportunity to improve its performance with uncached items.
Consider the following:
- Git does a checkout operation after a
fetchorcloneon a repository with
many LFS objects. - Git asks LFS for the first remaining object in the checkout.
- LFS sees that the object is not in the cache, since this is a clone and no
objects are cached yet. - LFS downloads the file in whole, and then responds to Git.
- If the checkout is done, see step 6, else see step 2.
- Done
In the above, LFS has to download each large file one at a time before it can
move onto the next. While thinking about ways to improve this, I summarized some
discussion that @larsxschneider and I had been having in
#1632 (comment):
@larsxschneider and I have already begun talking about adding a new capability
to the protocol to allow thegit-filter-server(LFS) to "promise" that it
will convert a file and yield the path on disk where it will dump the result
of that conversion. [...]This will allow us to process many transfers concurrently, taking full
advantage of the proposed new transfer queue design, and yielding even greater
speeds for the new filter protocol implementation. Perhaps more importantly,
it will allow us to do normal Git operations (git clone,git push,
git pull, and etc.) without needing to temporarily disable the smudge filter
to parallelize the transfers. [...]
Propositions
Lars has already implemented a spike of what support for what this would look
like in #1646.
Since Lars' patch (see: git/git@487fe1f) is on 'next' and 'pu', I propose that we
expand on his spike above and add support for the 'delay' capability into Git LFS.
Technical Overview
See: the documentation in gitattributes.txt.
Non-goals
While this would allow us to remove two helper commands:
git lfs clonegit lfs fetch
I don't think that we can do this until a MAJOR semantic version, the next of
which would be v3.0.0. At that time, or before, I'd like to discuss the
feasibility of removing these commands.
/cc @git-lfs/core
/cc @larsxschneider
Activity
larsxschneider commentedon Aug 2, 2017
Sounds all good. However, I don't think we can get rid of
git lfs fetchbecausegit fetchwould never filter any files and therefore no Git LFS process would be invoked.git lfs clonecould certainly go 😄 ! Maybe we can mark it as deprecated with a warning on invocation in the 2.x series already?ttaylorr commentedon Aug 2, 2017
Ah, of course!
git lfs fetchwill have to stay. It would be nice ifgit fetchcould accept arbitrary flags that would be forwarded to any filter(s), but maybe that's for another time...Great idea: I think we should definitely do this.
larsxschneider commentedon Aug 14, 2017
The "delay" filter would also speed up the following use cases:
(1) If you switch to a branch (
git checkout xyz) with a lot of LFS files that you don't have on your local machine, yet.(2) If you rebase onto a branch (
git rebase) that has a lot of LFS that you don't have on your machine, yet.(3) If you pull from a branch (
git pull) to which other people added a lot of LFS files since you pulled last.In all these use cases "pre-delay Git LFS" would download the LFS files sequentially. With the delay filter Git LFS can download the files in parallel. With "a lot of LFS files" I mean more than 20 or so.
On top of all that Git LFS will become faster in all kinds of tools that shell out to Git (Jenkins, SmartGit, SourceTree, ...). For instance Jenkins doesn't know about special commands such as
git lfs clone. Therefore,git cloneis horrible slow for repositories with many files in LFS. The delay filter will make all these tools immediately faster.--
🎉 The delay filter was just merged into the master branch of git/git 🎉
technoweenie commentedon Aug 14, 2017
I'm all for deprecating it. We should recommend users update Git, but keep the command around for any stragglers. Also, reject PRs for support of any new
cloneflags, since new flags would mean you have a new enough Git with delay support :) 👍larsxschneider commentedon Oct 30, 2017
Git 2.15 shipped with support for delayed filters today 🎉
https://public-inbox.org/git/[email protected]/
Hidden in the release notes as:
jamesblackburn commentedon Nov 14, 2017
In case this helps someone googling. I updated an existing environment to
git=2.15.0andgit-lfs=2.3.4and still saw no delayed functionality...git lfs clonewas still significantly faster and warning:Turned out the fix is to run install at least once more:
at least once with the new versions of
gitandgit-lfs.larsxschneider commentedon Nov 14, 2017
Interesting. I guess the reason was that your global Git config did not include
filter.lfs.process, yet.@ttaylorr / @technoweenie : Is that possible? I thought Git LFS would update the global Git config in that case but I am not familiar with these code paths...
technoweenie commentedon Nov 14, 2017
Sure, Git LFS can do that with
git lfs installorgit lfs update(either will work). The trick is actually running it. It is run automatically if you install through our windows installer, debian package, rpm, or the install.sh included in our the prebuilt tarballs. I'm not sure about other GUIs like GH Desktop or SourceTree, so you'll have to check with them. If you're compiling on your own, well you're on your own :)larsxschneider commentedon Nov 15, 2017
@jamesblackburn How did you get LFS 2.3.4 on your machine?
docs/man/git-lfs-clone.adoc: deprecate command
docs/man/git-lfs-clone.adoc: deprecate command