<div dir="ltr">Zaro, <div><br></div><div>Thank you for the research, seems like we should definitely run gc against nova repo. </div><div><br></div><div><br></div><div>Best regards,</div><div>Boris Pavlovic </div></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Mar 25, 2016 at 5:47 PM, Zaro <span dir="ltr"><<a href="mailto:zaro0508@gmail.com" target="_blank">zaro0508@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">So I've been researching this and I've found that there is a<br>
significant performance improvement after running git gc on this nova<br>
repro.  Below are my results.<br>
<br>
File sizes of repo as-is:<br>
~/nova.git.orig$ du -hsx * | sort -r | head -10<br>
6.4G objects<br>
6.1M info<br>
4.0K config<br>
4.0K HEAD<br>
382M refs<br>
2.1M logs<br>
 0B hooks<br>
 0B description<br>
 0B branches<br>
<br>
Note that the repro as-is has already been thru a 'git repack -afd'.<br>
<br>
<br>
File sizes after running 'jgit gc':<br>
~/nova.git.test$ du -hsx * | sort -r | head -10<br>
6.1M packed-refs<br>
6.1M info<br>
420M objects<br>
4.0K config<br>
4.0K HEAD<br>
2.1M logs<br>
 0B refs<br>
 0B hooks<br>
 0B description<br>
 0B branches<br>
<br>
The result is that the gc cleans up the objects (6.4G -> 420M) and<br>
moves the loose ref objects from 'refs' dir to a 'packed-refs' file<br>
(382M -> 6.1M).<br>
<br>
Note that I'm using jgit because that's what Gerrit would use to do<br>
the 'gc'.  The jgit version is 4.0.1.201506240215-r which is the one<br>
that's packaged with our current version of Gerrit<br>
(2.11.4-11-ga14450f) on review.o.o<br>
<br>
<br>
Here I've tested the performance of the git clone, fetch and push<br>
before and after running 'jgit gc':<br>
<br>
`git clone`<br>
------------<br>
before:<br>
real  3m30.163s<br>
user 0m2.020s<br>
sys   3m15.087s<br>
<br>
after:<br>
real  0m0.925s<br>
user 0m0.406s<br>
sys   0m0.621s<br>
<br>
<br>
`git fetch origin stable/liberty`<br>
---------------------------------<br>
before:<br>
real  0m4.271s<br>
user 0m0.701s<br>
sys   0m2.949s<br>
<br>
after:<br>
real  0m0.686s<br>
user 0m0.348s<br>
sys   0m0.307s<br>
<br>
<br>
`git push origin HEAD:refs/for/master`<br>
--------------------------------------<br>
before:<br>
real  0m36.454s<br>
user 0m5.346s<br>
sys   0m27.598s<br>
<br>
after:<br>
real  0m16.588s<br>
user 0m11.731s<br>
sys   0m3.218s<br>
<br>
Note: I pushed the exact same change for both scenarios.<br>
<br>
<br>
Conclusion:<br>
The results indicate that it would be very advantages to run 'git gc'<br>
for both file size reduction and improved performance. Below are<br>
additional resources that I've found on the internet that seems to<br>
back up my results.<br>
<br>
<br>
<br>
references:<br>
<br>
This says that one-file-per-ref format both wastes storage and hurts<br>
performance:  <a href="https://git-scm.com/docs/git-pack-refs" rel="noreferrer" target="_blank">https://git-scm.com/docs/git-pack-refs</a><br>
<br>
This outlines some of the benefits and drawbacks of packed-refs file:<br>
<a href="https://www.mail-archive.com/git%40vger.kernel.org/msg65722.html" rel="noreferrer" target="_blank">https://www.mail-archive.com/git%40vger.kernel.org/msg65722.html</a><br>
<br>
Info on speeding up clones/fetches with pack bitmaps:<br>
<a href="https://www.mail-archive.com/git%40vger.kernel.org/msg65571.html" rel="noreferrer" target="_blank">https://www.mail-archive.com/git%40vger.kernel.org/msg65571.html</a><br>
<div class="HOEnZb"><div class="h5"><br>
On Fri, Jan 8, 2016 at 12:13 PM, James E. Blair <<a href="mailto:corvus@inaugust.com">corvus@inaugust.com</a>> wrote:<br>
> Hi,<br>
><br>
> With the new version of Gerrit offering built-in "git gc" capability, we<br>
> looked at the current state of our git repo maintenance.  We run "git<br>
> repack -afd" weekly in an attempt to produce the smallest packfiles<br>
> possible, but it does not prune loose objects, which seems to be the<br>
> main thing "git gc" does that we are missing.<br>
><br>
> Some (relatively) quick experimentation suggests that various<br>
> combinations of "git gc", "git repack", "git prune", "git prune-packed"<br>
> all have effects on the overall repo size, the number of pack files, and<br>
> the number of loose objects.<br>
><br>
> However, we don't just want to find the thing that makes the smallest<br>
> repo size (that's easy: "git prune; git gc" -- 394M for nova; one<br>
> packfile with all objects and one packed-refs file with all refs)<br>
> because this repo is used as the basis of all of our mirrors and is<br>
> accessed over several protocols.  It's not immediately clear what the<br>
> right optimization is for our situation -- we don't necessarily want to<br>
> trade on-disk size for reduced network performance.  Even the packing of<br>
> refs isn't entirely straightforward -- while we haven't needed to for<br>
> some time, we have, in the past removed refs.<br>
><br>
> We're looking for a volunteer to really dig into this problem and<br>
> thoroughly evaluate the implications of different ways of optimizing the<br>
> repo.  If you're interested, you can download a snapshot of the full<br>
> nova repository from Gerrit (it is a point-in-time snapshot and will not<br>
> be updated) at this URL:<br>
><br>
>   <a href="http://tarballs.openstack.org/ci/nova.git.tar.bz2" rel="noreferrer" target="_blank">http://tarballs.openstack.org/ci/nova.git.tar.bz2</a><br>
><br>
> Please follow up this message if you are interested and with any<br>
> findings.<br>
><br>
> Thanks,<br>
><br>
> Jim<br>
><br>
> _______________________________________________<br>
> OpenStack-Infra mailing list<br>
> <a href="mailto:OpenStack-Infra@lists.openstack.org">OpenStack-Infra@lists.openstack.org</a><br>
> <a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra</a><br>
<br>
_______________________________________________<br>
OpenStack-Infra mailing list<br>
<a href="mailto:OpenStack-Infra@lists.openstack.org">OpenStack-Infra@lists.openstack.org</a><br>
<a href="http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra" rel="noreferrer" target="_blank">http://lists.openstack.org/cgi-bin/mailman/listinfo/openstack-infra</a><br>
</div></div></blockquote></div><br></div>