Repository fetches should pack loose objects and refs
Numerous customers have seen performance issues largely due to a git fetch
keeping around loose objects and refs. For example, after a GitHub import with 20,000 pull requests, we created about 50,000+ keep-around refs, all of which were loose refs.
When GitLab attempts to read the refs, it has to read thousands of loose files, and this takes a long time. Running a git pack-refs --all
dramatically made things faster.
We should run git gc
and git pack-refs --all
after a fetch. I know that ~Geo encountered this a while ago in https://gitlab.com/gitlab-org/gitlab-ee/issues/5447. It looks like we only fixed this for Geo in https://gitlab.com/gitlab-org/gitlab-ee/merge_requests/5261.