From: Nicolas Pitre <nico@cam.org>
To: Junio C Hamano <junkio@cox.net>
Cc: git@vger.kernel.org
Subject: [PATCH] change the unpack limit treshold to a saner value
Date: Wed, 06 Dec 2006 16:08:56 -0500 (EST) [thread overview]
Message-ID: <Pine.LNX.4.64.0612061420410.2630@xanadu.home> (raw)
Let's assume the average object size is x. Given n objects, the needed
storage size is n*(x + b), where b is the average wasted block size on
disk.
If those objects are packed, the needed storage becomes n*x + b so we
save on the block overhead. But there is the pack index which is
1024 + n*24 + b.
Trying to find the value of n where packed objects become an advantage,
we have:
n*x + n*b > n*x + n*24 + 2*b + 1024
n*b - 2*b > n*24 + 1024
(n - 2)*b > n*24 + 1024
So given this we need at least 3 objects for the whole to use more space
than a pack, and only if b is greater than 1096. Since a common block
size is 4096 then the value of b is likely to converge towards 2048. 3
objects is also where more directory entries are used over an constant
of 2 for a pack (assuming that both objects would end up with the same
first 2 bytes of hash which is overly optimistic). So 3 should be the
optimal number of objects for not exploding a pack. And of course
larger packs are likely to take even less space due to delta compression
kicking in.
This is why I think the current default treshold should be 3 instead of
the insane value of 5000. But since it feels a bit odd to go from 5000
to 3 I setled on 10.
Signed-off-by: Nicolas Pitre <nico@cam.org>
---
Sidenote: I think it is OK for pushes to _not_ use thin packs. When
not exploding thin packs, they must be completed by adding objects
creating duplicates and using more disk space. The penalty for not
using thin packs is a slight increase in bandwidth for push operations,
but since pushes are normally much less frequent than fetches it seems
OK to penalize the push a bit for a better disk usage on servers.
diff --git a/receive-pack.c b/receive-pack.c
index d62ed5b..9140312 100644
--- a/receive-pack.c
+++ b/receive-pack.c
@@ -11,7 +11,7 @@
static const char receive_pack_usage[] = "git-receive-pack <git-dir>";
static int deny_non_fast_forwards = 0;
-static int unpack_limit = 5000;
+static int unpack_limit = 10;
static int report_status;
next reply other threads:[~2006-12-06 21:09 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-12-06 21:08 Nicolas Pitre [this message]
2006-12-06 22:24 ` [PATCH] change the unpack limit threshold to a saner value Junio C Hamano
2006-12-07 0:19 ` Nicolas Pitre
2006-12-07 1:08 ` [PATCH] change the unpack limit treshold " Linus Torvalds
2006-12-07 3:24 ` Nicolas Pitre
2006-12-07 3:39 ` Linus Torvalds
2006-12-07 4:01 ` [PATCH take 2] " Nicolas Pitre
2006-12-07 7:59 ` Shawn Pearce
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0612061420410.2630@xanadu.home \
--to=nico@cam.org \
--cc=git@vger.kernel.org \
--cc=junkio@cox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).