git/list[1] front-page[2] threads[3] people[4] search[5] about
 

auto-packing on kernel.org? please?

From
Linus Torvalds <torvalds@osdl.org>
Date
Oct 13, 2005, 18:44 UTC
Message-ID
<Pine.LNX.4.64.0510131113490.15297@g5.osdl.org>

I know we tried this once earlier, and it caused problems, but that was when pack-files were new, and not everybody could handle them. These days, if you can't handle pack-files, kernel.org is already pretty useless, because all the major packages use them anyway, because people have packed their repositories by hand.

So I'm suggesting we try to do an automatic repack every once in a while. 

In my suggestion, there would be two levels of repacking: "incremental" and "full", and both of them would count the number of files before they run, so that you'd only do it when it seems worthwhile.

This is a _really_ simple heuristic:
 - incremental repacking run every day:
	#
	# Check if we have more than a couple of hundred
	# unpacked objects - approximated by whether we
	# have any "00" directory with more than one 
	#
	# This means that we don't repack projects that
	# that don't have a lot of work going on.
	#
	# Note: with really new versions of git, the "00"
	# directory may not exist if it has been pruned
	# away, so handle that gracefully.
	#
	export GIT_DIR=${1:-.}
	objs=$(find "$GIT_DIR/objects/00" -type f 2> /dev/null | wc -l)
	if [ "$obj" -gt 0 ]; then
		git repack &&
			git prune-packed
	fi
 - "full repack" every week if the number of packs has grown to be bigger 
   than say 10 (ie even a very active projects will never have a full 
   repack more than every other week)
	#
	# Check if we have lots of packs, where "lots" is defined as 10.
	#
	# Note: with something that was generated with an old version
	# of git, the "pack" directory may not exist, so handle that
	# gracefully.
	#
	export GIT_DIR=${1:-.}
	packs=$(find "$GIT_DIR/objects/pack" -name '*.idx' 2> /dev/null | wc -l)
	if [ "$packs" -gt 10 ]; then
		git repack -a -d &&
			git prune-packed
	fi
 - do a full repack of everything once to start with.
	export GIT_DIR=${1:-.}
	git repack -a -d &&
		git prune-packed

the above three trivial scripts just take a single argument, which becomes the GIT_DIR (and if no argument exists, it would default to ".")

Is there any reason not to do this? Right now mirroring is slow, and webgit is also getting to be very slow sometimes. I bet we'd be _much_ better off with this kind of setup.

NOTE! The above is the "stupid" approach, which totally ignores alternate directories, and isn't able to take advantage of the fact that many projects could share objects. But it's simple, and it's efficient (eg it won't spend time on things like the large historic archives which don't change, but that would be expensive to repack if you didn't check for the need).

So we could try to come up with a better approach eventually, which would automatically notice alternate directories and not repack stuff that exists there, but I'm pretty sure that the above would already help a _lot_, and while pack-files have been been around forever, the "alternates" support is still pretty new, so the above is also the "safer" thing to do.

We'd only do the automatic thing on stuff under /pub/scm, of course: not stuff in peoples home directories etc..

Peter?
			Linus
Next: Carl Baldwin
Message 1 of 33 in “auto-packing on kernel.org? please?”
  1. Linus TorvaldsOct 13, 2005
  2. Carl BaldwinNov 21, 2005
  3. Linus TorvaldsNov 21, 2005
  4. Junio C HamanoNov 21, 2005
  5. Linus TorvaldsNov 21, 2005
  6. Junio C HamanoNov 21, 2005
  7. Chuck LeverNov 22, 2005
  8. Linus TorvaldsNov 22, 2005
  9. Catalin MarinasNov 22, 2005
  10. Linus TorvaldsNov 22, 2005
  11. Chuck LeverNov 22, 2005
  12. Catalin MarinasNov 23, 2005
  13. Carl BaldwinNov 22, 2005
  14. Linus TorvaldsNov 22, 2005
  15. Linus TorvaldsOct 13, 2005
  16. Dirk BehmeOct 16, 2005
  17. Daniel BarkalowOct 16, 2005
  18. Nick HengeveldOct 16, 2005
  19. Brian GerstOct 16, 2005
  20. Junio C HamanoOct 16, 2005
  21. Nick HengeveldOct 16, 2005
  22. Junio C HamanoOct 16, 2005
  23. Nick HengeveldOct 17, 2005
  24. Junio C HamanoOct 17, 2005
  25. Nick HengeveldOct 17, 2005
  26. Junio C HamanoOct 17, 2005
  27. Daniel BarkalowOct 17, 2005
  28. Linus TorvaldsOct 17, 2005
  29. Nick HengeveldOct 17, 2005
  30. Daniel BarkalowOct 17, 2005
  31. Johannes SchindelinOct 16, 2005
  32. Brian GerstOct 16, 2005
  33. Catalin MarinasNov 23, 2005

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.