From 6e42b112b1cebaa486c926fda759a1144cd0fe45 Mon Sep 17 00:00:00 2001 From: Sam Thursfield Date: Mon, 9 Nov 2015 12:43:40 +0000 Subject: Only run as many parallel jobs as there are available CPU cores YBD has been doing this for a while and seems like it is faster as a result. Change-Id: I8f95a53195cdbc2c75c06a8abe9eb089a84b1c1b --- morphlib/util.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/morphlib/util.py b/morphlib/util.py index e34799df..ec83df25 100644 --- a/morphlib/util.py +++ b/morphlib/util.py @@ -93,10 +93,12 @@ def make_concurrency(cores=None): ''' n = cpu_count() if cores is None else cores - # Experimental results (ref. Kinnison) says a factor of 1.5 - # gives about the optimal result for build times, since much of - # builds are I/O bound, not CPU bound. - return max(int(n * 1.5 + 0.5), 1) + # Research shows that max-jobs should be == cores by default, up to max. + # 20 cores. + # + # http://listmaster.pepperfish.net/pipermail/ + # baserock-dev-baserock.org/2015-September/013264.html + return min(n, 20) def create_cachedir(settings): # pragma: no cover -- cgit v1.2.1