Building Debian packages on single CPU machines

Is building Debian packages with a single CPU machine intrinsically worse than doing so with a multi-core machine? Is it true, as some people claim, that nobody in his right mind would use single CPU machines to build Debian packages today?

To provide a partial answer for that, I've been building packages on machines with 1 CPU and 2 CPUs from Scaleway during the first half of 2019. These are the two types of machines I used:

(a) START1-XS. Those had 1 vCPU, 1GB of RAM, and they used to cost 2€/month. /proc/cpuinfo
(b) START1-S. Those had 2 vCPUs, 2GB of RAM, and they used to cost 4€/month. /proc/cpuinfo

This is of course a very particular case, but many VPS vendors have "all-in-one" plans like this, where a 2-CPU machine usually has double the RAM of a 1-CPU machine and it costs double the price per hour. Note also that the CPU specs for 1-CPU and 2-CPU machines are similar.

In this scenario, for (b) to be better than (a) in terms of total cost, the time required to build packages in (b) has to be half the time required to build packages in (a), or less. Otherwise we will not get any saving by building with 2 CPUs, as they cost double the price.

For this comparison, only packages requiring 1 GB of RAM or less have been tested. This is not really a small set, it represents approximately 96% of all source packages.

Also, to simplify the comparison, I've selected only the build logs made with "dpkg-buildpackage -A".

The results are shown in this data set, where the first column is the package name, the second column is total build time in seconds with 1 CPU, and the third column is total build time in seconds with 2 CPUs.


If we make a weighted average, where we sum all the times for all the packages, we find that building on machines with 2 CPUs is approximately 50% more expensive than building on machines with 1 CPU. This may be checked this way:

awk '{ s+=$2; t+=$3 } END { print 2*t/s }' data.txt

So, yes, in a general sense we all know that "the more CPUs, the better", but as soon as you have to actually pay for the extra CPUs, building on single CPU machines is still useful.

Note: The build logs on which this statistics are based are available here (for 1-CPU) and here (for 2-CPU), but only for a limited time, as they take a lot of disk space in my server.