From ab8794c5b31a8faf274898a008f4b717bff38a1f Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Sun, 21 Aug 2016 12:48:00 -0700 Subject: [PATCH] Util.pm: change window memory calculation Git has enough overhead that using total-mem / 2 / num-CPUs can still lead to memory thrashing for some repositories when computing deltas. Change to total-mem / 3 / num-CPUs to leave enough room for Git's overhead to avoid memory thrashing. Signed-off-by: Kyle J. McKay --- Girocco/Util.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Girocco/Util.pm b/Girocco/Util.pm index 6e3a511..98eb0dc 100644 --- a/Girocco/Util.pm +++ b/Girocco/Util.pm @@ -878,14 +878,14 @@ sub _make_suffixed_size { # Return the value to pass to --window-memory= for git repack # If the system memory or number of CPUs cannot be determined, returns "1g" -# Otherwise returns half the available memory divided by the number of CPUs +# Otherwise returns one third the available memory divided by the number of CPUs # but never more than 1 gigabyte or max_gc_window_memory_size. sub calc_windowmemory { my $cpus = online_cpus; my $memsize = sys_memsize; my $max = 1024 * 1024 * 1024; if ($cpus && $memsize) { - $max = int($memsize / 2 / $cpus); + $max = int($memsize / 3 / $cpus); $max = 1024 * 1024 * 1024 if $max >= 1024 * 1024 * 1024; } my $maxconf = _get_max_conf_suffixed_size($Girocco::Config::max_gc_window_memory_size); -- 2.11.4.GIT