[OpenStack-Infra] Fun (important!) project: optimize Gerrit's nova git repo

Antoine Musso hashar at free.fr
Tue Jun 14 09:26:32 UTC 2016


On 13/06/16 18:29, Zaro wrote:
> `git gc` enables prune by default [1]. Running `git gc` cleans up the
> objects (6.4G -> 380M) and moves the refs to packed-refs file (382M ->
> 6M). I see the exact same result whether I run with C git or jgit.
>
> Original files:
>   ~/temp/nova.git.test$ du -hsx * | sort -r | head -10
>   6.4G nova.git.orig/objects
>   6.1M nova.git.orig/info
>   4.0K nova.git.orig/config
>   4.0K nova.git.orig/HEAD
>   382M nova.git.orig/refs
>   2.1M nova.git.orig/logs
>   0B nova.git.orig/hooks
>   0B nova.git.orig/description
>   0B nova.git.orig/branches

Hello,

On the non-gc repo you can get useful statistics regarding objects by 
using: git count-objects -vH

count: 37
size: 1.56 MiB
in-pack: 707396
packs: 5
size-pack: 276.97 MiB
prune-packable: 14
garbage: 1
size-garbage: 2.81 MiB

 From the man page:

37 loose objects consuming 1.56MiB of disk.
707396 objects in pack files which is a 276.97 MiB
14 loose objects are in pack file and can be reclaimed: git prune-packed
1 neither valid loose or valid pack taking 2.81 MiB


Also Gerrit tends to leak references under refs/cache-automerge which 
might pill up and cause no more needed objects to still be referenced. 
I am not sure what they are for.

-- 
Antoine Musso



More information about the OpenStack-Infra mailing list