[PATCH] change the unpack limit treshold to a saner value

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxx>

---

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;
 
 static char capabilities[] = " report-status delete-refs ";
-
To unsubscribe from this list: send the line "unsubscribe git" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]