threads / discuss / 31927

Large number of object files

Subject: Large number of object files

## tl;dr

3 messages between Oct 24, 2012 and Oct 24, 2012.

replies: 2people: 3as markdown or json

Uri Moszkowicz· Oct 24, 2012, 05:21 UTC · lore

Continuing to work on improving clone times, using "git gc --aggressive" has resulted in a large number of tags combining into a single file but now I have a large number of files in the objects directory - 131k for a ~2.7GB repository. Any way to reduce the number of these files to speed up clones?

Nguyen Thai Ngoc Duy· Oct 24, 2012, 06:59 UTC · re: Uri Moszkowicz · lore

Re: Large number of object files

On Wed, Oct 24, 2012 at 12:21 PM, Uri Moszkowicz <uri@4refs.com> wrote:
> Continuing to work on improving clone times, using "git gc
> --aggressive" has resulted in a large number of tags combining into a
> single file but now I have a large number of files in the objects
> directory - 131k for a ~2.7GB repository.

Can you paste "git count-objects -v"? I'm curious why gc keeps so many loose objects around.

> Any way to reduce the number of these files to speed up clones?

An easy way to get rid of them is to clone the non-local way. Everything will be sent over a pack, the result would be a single pack in new repo. Try "git clone file:///path/to/source/repo new-repo". You can also try "git prune" on the existing repo (read its man page before use).

-- 
Duy
Jeff King· Oct 24, 2012, 07:11 UTC · re: Nguyen Thai Ngoc Duy · lore

Re: Large number of object files

On Wed, Oct 24, 2012 at 01:59:16PM +0700, Nguyen Thai Ngoc Duy wrote:
Show 8 quoted lines
> On Wed, Oct 24, 2012 at 12:21 PM, Uri Moszkowicz <uri@4refs.com> wrote:
> > Continuing to work on improving clone times, using "git gc
> > --aggressive" has resulted in a large number of tags combining into a
> > single file but now I have a large number of files in the objects
> > directory - 131k for a ~2.7GB repository.
> 
> Can you paste "git count-objects -v"? I'm curious why gc keeps so many
> loose objects around.

Presumably ejected from the pack because they are now unreachable. That's a rather large number, but if there was recent ref maintenance (e.g., deleting branches or tags), it is not impossible.

Show 5 quoted lines
> > Any way to reduce the number of these files to speed up clones?
> 
> An easy way to get rid of them is to clone the non-local way.
> Everything will be sent over a pack, the result would be a single pack
> in new repo. Try "git clone file:///path/to/source/repo new-repo".

If you have git v1.7.12 or greater, you can also use the "--no-local" option to clone. But as you mentioned, pruning is probably the most sensible thing (and for a non-local clone, those objects should not impact performance at all, as we will never even look at unreferenced objects).

-Peff

← back to recent threads