Experiment with wrapping the git binary in a script that invokes git into a cgroup

Gitaly allows specifying the path for the git executable. We can make a small wrapper script that spawns git processes using cgexec or systemd-run, the latter can be used to specify resource group properties such as MemoryMax or CPUWeights.

Pros:

  • Minimum to no changes in Gitaly and omnibus
  • Full control over the management of cgroups

Cons:

  • Two extra executions (wrapper script and cgexec/systemd-run) can add a noticeable overhead, would need to be measured
  • No control over the distribution of git process into the cgroups
    • Technically we may be able to distribute the processes by the repository they operate on, through the inspection of the --git-dir argument, but that would be an overload of a wrapper script that shouldn't have such logic in it.

All in all, it may prove to be a good initial solution to the problem of resource contention, we just need to test it for a bit to determine its viability. I'm doing so in a local installation for starters.

Edited by Ahmad Sherif