This repository was archived by the owner on Jun 30, 2021. It is now read-only.

Description
In order to limit resource (CPU) usage on the CI server, it would be beneficial to include a way to set up some limits.
The initial idea is to do it when we build docker-compose in the DockerComposeYamlBuilder:
$composeConfig[$ciContainerName]['cpu_shares'] = 50;
$composeConfig[$ciContainerName]['cpu_quota'] = '...';
$composeConfig[$ciContainerName]['cpu_period'] = '...';
To consider:
- CPU quota depends on the CI server configuration (it's actually depending even on the node that the given job is executed). We should find a way to make intelligent.
- there is the nice description here:
https://www.kernel.org/doc/Documentation/scheduler/sched-bwc.txt
what we could do is to detect a number of CPU cores on the given machine and then limit cpu_quota to - let's say 95% of the CPU.
- we could also make it very static and allow a single job to use not more than the given percentage of the cores on the ci server.
- if the single stage is executing multiple concurrent jobs we should probably limit them even further to avoid a situation when we burn CPU heavily and that leads to unstable CI server.