[libvirt] compressing .git/ can save 15%

Hi DV, I ran this on a fresh clone of libvirt: $ du -sh .git; git gc --aggressive; du -sh .git 54M .git ... 45M .git I propose to do the same thing on the server, libvirt.org. It's not a big deal, but decreased bandwidth wouldn't hurt, and the slightly smaller on-disk repository makes even local git tools feel a little snappier. It's worth doing for all git repositories. As far as I know, no one stores anything useful as "unlinked" commits on the server (they would be removed by the above), so there is no down-side to doing this. In fact, "man git-gc" recommends to run git gc --aggressive "every few hundred changesets or so". Adding a cron job to do it every few weeks would be nice (e.g., Sunday at 4am local). Let me know and I'll do it via my account.

On Wed, Jan 12, 2011 at 11:14:23AM +0100, Jim Meyering wrote:
Hi DV,
Hi Jim !
I ran this on a fresh clone of libvirt:
$ du -sh .git; git gc --aggressive; du -sh .git 54M .git ... 45M .git
I propose to do the same thing on the server, libvirt.org. It's not a big deal, but decreased bandwidth wouldn't hurt, and the slightly smaller on-disk repository makes even local git tools feel a little snappier. It's worth doing for all git repositories.
As far as I know, no one stores anything useful as "unlinked" commits on the server (they would be removed by the above), so there is no down-side to doing this. In fact, "man git-gc" recommends to run git gc --aggressive "every few hundred changesets or so". Adding a cron job to do it every few weeks would be nice (e.g., Sunday at 4am local). Let me know and I'll do it via my account.
Hum, I already have something similar running: xmlsoft:~ -> cat bin/GitMaintainance #!/bin/sh # Garbage collect the libvirt GIT repository git --git-dir /git/libvirt.git gc > $HOME/tmp/GitMaintainance.log 2>&1 xmlsoft:~ -> crontab -l | grep GitMaintainance 4 4 * * Sun /u/veillard/bin/GitMaintainance xmlsoft:~ -> Seems to have run normally on Sun 9 Jan from what I can tell :-) So basically I should just add --aggressive to the garbage collection command for extra cleanup, right ? Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Daniel Veillard wrote: ...
xmlsoft:~ -> cat bin/GitMaintainance #!/bin/sh # Garbage collect the libvirt GIT repository git --git-dir /git/libvirt.git gc > $HOME/tmp/GitMaintainance.log 2>&1 xmlsoft:~ -> crontab -l | grep GitMaintainance 4 4 * * Sun /u/veillard/bin/GitMaintainance xmlsoft:~ ->
Seems to have run normally on Sun 9 Jan from what I can tell :-)
So basically I should just add --aggressive to the garbage collection command for extra cleanup, right ?
Exactly ;-)

On Wed, Jan 12, 2011 at 12:01:12PM +0100, Jim Meyering wrote:
Daniel Veillard wrote: ...
xmlsoft:~ -> cat bin/GitMaintainance #!/bin/sh # Garbage collect the libvirt GIT repository git --git-dir /git/libvirt.git gc > $HOME/tmp/GitMaintainance.log 2>&1 xmlsoft:~ -> crontab -l | grep GitMaintainance 4 4 * * Sun /u/veillard/bin/GitMaintainance xmlsoft:~ ->
Seems to have run normally on Sun 9 Jan from what I can tell :-)
So basically I should just add --aggressive to the garbage collection command for extra cleanup, right ?
Exactly ;-)
Okay, done, BTW here is the result for a manual run I did: xmlsoft:~ -> git --git-dir /git/libvirt.git gc --aggressive Counting objects: 50594, done. Delta compression using up to 2 threads. Compressing objects: 100% (50455/50455), done. Writing objects: 100% (50594/50594), done. Total 50594 (delta 42525), reused 0 (delta 0) xmlsoft:~ -> Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

Daniel Veillard wrote:
On Wed, Jan 12, 2011 at 12:01:12PM +0100, Jim Meyering wrote:
Daniel Veillard wrote: ...
xmlsoft:~ -> cat bin/GitMaintainance #!/bin/sh # Garbage collect the libvirt GIT repository git --git-dir /git/libvirt.git gc > $HOME/tmp/GitMaintainance.log 2>&1 xmlsoft:~ -> crontab -l | grep GitMaintainance 4 4 * * Sun /u/veillard/bin/GitMaintainance xmlsoft:~ ->
Seems to have run normally on Sun 9 Jan from what I can tell :-)
So basically I should just add --aggressive to the garbage collection command for extra cleanup, right ?
Exactly ;-)
Okay, done, BTW here is the result for a manual run I did:
xmlsoft:~ -> git --git-dir /git/libvirt.git gc --aggressive Counting objects: 50594, done. Delta compression using up to 2 threads. Compressing objects: 100% (50455/50455), done. Writing objects: 100% (50594/50594), done. Total 50594 (delta 42525), reused 0 (delta 0) xmlsoft:~ ->
That tells you the number of "objects", which doesn't change. du -sh /git/libvirt.git before showed 54M. Now, it prints 45M.
participants (2)
-
Daniel Veillard
-
Jim Meyering