Repository navigation
Description
gitcommitexp.log
Some context
We have a 50G GIT/GIT-LFS based repository. We then build about 900G of build articles.
To accelerate development, we copy this workspace into a EXT4 formatted disk image and snapshot it
Developers clone this disk image quickly, mount it and they have a fully built workspace that they can do incremental builds on.
Problem 1: resolved
after mounting the diskimage, "git status" and "git diff" used to take 40 minutes.
After some discussions on thhe GIT alias, I was asked do a "git update-index --refresh" after copying over the GIT workspace to the diskimage. It was suggested that the git-index that tracks source tree information included node information that would not be valid after it GIT wokspace was copied into a new filesystem.
So we now do a "git update-index --refresh" in the diskimage after git workspace copy and before we snapshot. After this the cloned/mounted diskimage performed better. First time "git status/diff" is now down to 1m30 seconds, subsequence commands were always in <10 seconds.
Problem 2:
Now in the above workspace, if I now try to do a local commit of a simple 1 line code change, It takes about 5 minutes.
"git commit -m "dummy commit" of a 1 line change in 1 file takes about 5-6
minutes, everytime in this workspace. Tracing shows a whole bunch.
The entire 5-6
minutes worth of the following sort of trace logs. 3:13:50.320930 trace git-lfs:
filepathfilter: rejecting "x/y/z.o.command" via [] 13:13:50.320940 trace git-lfs:
filepathfilter: accepting " x/y/z.o.command " 13:13:50.320862 trace git-lfs:
filepathfilter: rejecting "a/b/c/d.o.command" via [] 13:13:50.320972 trace git-lfs:
filepathfilter: accepting " a/b/c/d..o.command"
The git folks suggest this is not a GIT problem but might be git-lfs
These are messages from the Git LFS tool, and this list does not provide
support for Git LFS, since it is a separate project not affiliated with
Git.I would recommend that you create an issue on Git LFS's tracker at:
and mention that you are seeing lots of 'filepathfilter' logs. My
speculation is that this could be a slowdown in the 'filepathfilter'
code paths, or an entire-tree scan where 'filepathfilter' is invoked
every so often. I'd mention both of those as possibilities (or send a
link to this email on public-inbox), and see if anything comes up.
Does anyone here have any idea on what might be causing this? Or how to improve on this?
I have attached portions of the log from the following git command
GIT_CURL_VERBOSE=1 GIT_TRACE=1 time git commit -m "Hello message more more" >gitcommit.log 2>&1
The full gitommit.log file is 4.5GB in size some 27M lines.
bash-4.1$ wc -l gitcommit.log
27953652 gitcommit.log
What I have attached is a representative sample, apart from file/directory names being different there isn't much else different as shown below
bash-4.1$ cat gitcommit.log | grep -v "accepting" | grep -v "rejecting" | grep -v "rewrite"
18:40:55.491599 git.c:415 trace: built-in: git commit -m 'Hello message more more'
18:40:56.356085 run-command.c:637 trace: run_command: git gc --auto
18:40:56.364464 git.c:415 trace: built-in: git gc --auto
18:40:56.366081 run-command.c:637 trace: run_command: GIT_EDITOR=: GIT_INDEX_FILE=.git/index .git/hooks/post-commit
18:40:56.376149 git.c:659 trace: exec: git-lfs post-commit
18:40:56.376212 run-command.c:637 trace: run_command: git-lfs post-commit
18:40:56.380867 trace git-lfs: exec: git 'version'
18:40:56.385136 trace git-lfs: exec: git 'config' '-l'
18:40:56.389123 trace git-lfs: exec: git 'config' '-l' '-f' '/witspace/sarvi/space_sarvi_testws1/.lfsconfig'
18:40:56.391505 trace git-lfs: exec: git '-c' 'filter.lfs.smudge=' '-c' 'filter.lfs.clean=' '-c' 'filter.lfs.process=' '-c' 'filter.lfs.required=false' 'rev-parse' 'HEAD' '--symbolic-full-name' 'HEAD'
[S2C-build-polaris_dev-95129 a9a056287365] Hello message more more
1 file changed, 1 insertion(+)
400.85user 760.46system 24:15.87elapsed 79%CPU (0avgtext+0avgdata 125756maxresident)k
10397264inputs+9425256outputs (23major+45502minor)pagefaults 0swaps
Activity
bk2204 commentedon Aug 27, 2019
Hey,
Can you run the commit with
GIT_TRACE=1and provide the output here (as an attached file)? That would be useful for us to see where the performance problem might lie. The filepathfilter is invoked in several different cases and we'd need to see where it's being invoked that's problematic.sarvi commentedon Aug 28, 2019
gitcommitexp.log
log attached here. Some more context on the log added to the original message. The original log is 4.5GB in size, so I did not upload the whole thing.
Some additional context
bash-4.1$ git-lfs version
git-lfs/2.5.1 (GitHub; linux amd64; go devel +bd98a81dc2 Thu Jul 26 17:13:12 2018 +0000; git e162848)
bash-4.1$ git version
git version 2.19.1
bash-4.1$ git-lfs env
git-lfs/2.5.1 (GitHub; linux amd64; go devel +bd98a81dc2 Thu Jul 26 17:13:12 2018 +0000; git e162848)
git version 2.19.1
Endpoint=https://gitlfs.cisco.com/artifactory/api/lfs/polaris-acme2git (auth=basic)
LocalWorkingDir=/witspace/sarvi/space_sarvi_testws1
LocalGitDir=/witspace/sarvi/space_sarvi_testws1/.git
LocalGitStorageDir=/witspace/sarvi/space_sarvi_testws1/.git
LocalMediaDir=/witspace/sarvi/space_sarvi_testws1/.git/lfs/objects
LocalReferenceDirs=
TempDir=/witspace/sarvi/space_sarvi_testws1/.git/lfs/tmp
ConcurrentTransfers=3
TusTransfers=false
BasicTransfersOnly=false
SkipDownloadErrors=false
FetchRecentAlways=false
FetchRecentRefsDays=7
FetchRecentCommitsDays=0
FetchRecentRefsIncludeRemotes=true
PruneOffsetDays=3
PruneVerifyRemoteAlways=false
PruneRemoteName=origin
LfsStorageDir=/witspace/sarvi/space_sarvi_testws1/.git/lfs
AccessDownload=basic
AccessUpload=basic
DownloadTransfers=basic
UploadTransfers=basic
git config filter.lfs.process = "git-lfs filter-process"
git config filter.lfs.smudge = "git-lfs smudge -- %f"
git config filter.lfs.clean = "git-lfs clean -- %f"
bash-4.1$
bash-4.1$ time git version
git version 2.19.1
real 0m0.027s
user 0m0.000s
sys 0m0.003s
bash-4.1$ time git config -l -f /witspace/sarvi/
warning: unable to access '/witspace/sarvi/': Is a directory
fatal: unable to read config file '/witspace/sarvi/': Is a directory
real 0m0.048s
user 0m0.003s
sys 0m0.004s
bash-4.1$ time git -c filter.lfs.smudge= -c filter.lfs.clean= -c filter.lfs.process= -c filter.lfs.required=false rev-parse HEAD --symbolic-full-name HEAD
a9a056287365fa17fcc55798c6fc257d8868176f
refs/heads/S2C-build-polaris_dev-95129
real 0m0.013s
user 0m0.002s
sys 0m0.001s
Also note, If interrupted the git command command after say 5 seconds. The diffs are committed anyway.
For example below
So some how, something after commit is taking up that extra 5+ minutes
bk2204 commentedon Aug 28, 2019
What's happening here is that Git LFS is checking files to see if any of them are locked and need to be set to read-only via a
post-commithook. It is currently known that this process isn't very efficient and needs to be improved; we're tracking this through #3668 and other issues.If you don't need your locked files set to read-only, or you aren't using locking, you can set the config option
lfs.setlockablereadonlyto false and that should make thepost-commitexit without doing any work.sarvi commentedon Sep 3, 2019
This is a bit confusing, This is a workspace of roughly 50G(git + git-lfs) content. But there is 900G of built content private files. Why would the git-lfs be locking the 900G of private content, when git-index maintains what files are part of git/git-lfs ?
bk2204 commentedon Sep 3, 2019
It's possible to lock and unlock files that are not in the repository. For example, if I lock file
foobarand then it gets deleted in a branch, I may still need to unlock it because it exists in other branches.In addition, the current design doesn't iterate over the index, it performs
.gitignorematching itself. Fixing it so that it doesn't iterate over the entire repository in this case is one of the ways we plan on fixing #3668 and other issues. It's definitely a thing we want to do, we just haven't done it yet.sudonym1 commentedon Sep 17, 2019
I have a patch that uses
git ls-files -zo --exclude-standardto locate the.gitattributesfiles within the repo. It seems to fix the performance issues I am seeing. Is this approach acceptable? Should I clean up and post the patch?Edit: this approach will work fully replace the custom parsing of the exclude files. To determine if a file is excluded, all that is necessary is to check if the file is included in a hash map of the files output by
git ls-files.Use git-ls-files to enumerate repo contents.
Use git-ls-files to enumerate repo contents.
Use git-ls-files to enumerate repo contents
sarvi commentedon Oct 2, 2019
This commit has helped reduce the time it takes to "git commit" but is still much slower than git commit without Git LFS involved.
Git commit Time with old git-lfs
sjc-ads-1690:> time git commit -m "Test"
[dev/swbhave/punt_ra c42b3fd72f4d] Test
1 file changed, 2 insertions(+)
142.488u 192.451s 0:45.31 739.1% 0+0k 727648+106720io 0pf+0w
Git commit time with new git-lfs
sjc-ads-1690:> time git commit -m "Test2"
[dev/swbhave/punt_ra e393e1054a56] Test2
1 file changed, 1 insertion(+)
60.700u 28.294s 1:21.91 108.6% 0+0k 39624+106704io 4pf+0w
There is a significant improvement, but it’s not as blazing fast as a normal git workspace.
sudonym1 commentedon Oct 2, 2019
it’s slower because lfs has to enumerate the work tree, whereas git would normally only touch the index. I didn’t dig into this requirement, but it seems like a good thing to address in a future change.
sarvi commentedon Oct 2, 2019
My understanding of the thread, was the right way to fix this would be use git index and not actually walk the tree.
Its good that this has improved it.
But shouldn't we keep the ticket open to get the right fix in ?
bk2204 commentedon Oct 2, 2019
Did you try setting
lfs.setlockablereadonlyto false? That should prevent Git LFS from needing to crawl the work tree in thepost-commithook if you're not using locking. It will make things significantly faster.If you're using lockable files, then there isn't any way to avoid traversing the working tree to find
.gitattributesfiles. With the changes in #3823, we do use the index to optimize this by usinggit ls-files, but we can't completely eliminate the need to traverse the directory structure.