summaryrefslogtreecommitdiffstats
path: root/debian/calc-max-parallel.sh
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:46:10 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:46:10 +0000
commit7050cdb205fd1b1b847c148092a8548f00a061c0 (patch)
tree05a497ffd12f14405445c3288085e228f4e8579f /debian/calc-max-parallel.sh
parentAdding upstream version 16.2.11+ds. (diff)
downloadceph-debian/16.2.11+ds-2.tar.xz
ceph-debian/16.2.11+ds-2.zip
Adding debian version 16.2.11+ds-2.debian/16.2.11+ds-2debian
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'debian/calc-max-parallel.sh')
-rwxr-xr-xdebian/calc-max-parallel.sh37
1 files changed, 37 insertions, 0 deletions
diff --git a/debian/calc-max-parallel.sh b/debian/calc-max-parallel.sh
new file mode 100755
index 000000000..d55d966c7
--- /dev/null
+++ b/debian/calc-max-parallel.sh
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# Simple tool to calculate max parallel jobs based on
+# memory of builder.
+#
+# MDCache.cc generally runs out of RAM in 4G of memory
+# with parallel=4
+
+if [ ""$(dpkg-architecture -qDEB_HOST_ARCH_BITS) = 32 ] ; then
+ echo "--max-parallel=1"
+ exit 0
+fi
+
+total_ram=$(grep MemTotal /proc/meminfo | awk '{ print $2 }')
+
+sixtyfour_g=$((64*1024*1024))
+fourtyheight_g=$((48*1024*1024))
+thirtytwo_g=$((32*1024*1024))
+sixteen_g=$((16*1024*1024))
+eight_g=$((8*1024*1024))
+four_g=$((4*1024*1024))
+
+if [ ${total_ram} -le ${four_g} ]; then
+ echo "--max-parallel=1"
+elif [ ${total_ram} -le ${eight_g} ]; then
+ echo "--max-parallel=2"
+elif [ ${total_ram} -le ${sixteen_g} ]; then
+ echo "--max-parallel=3"
+elif [ ${total_ram} -le ${thirtytwo_g} ]; then
+ echo "--max-parallel=8"
+elif [ ${total_ram} -le ${fourtyheight_g} ]; then
+ echo "--max-parallel=14"
+elif [ ${total_ram} -le ${sixtyfour_g} ]; then
+ echo "--max-parallel=18"
+else
+ echo "--max-parallel=24"
+fi