Skip to content

gitaly: Don't cleanup cgroups on exit

Will Chandler (ex-GitLab) requested to merge wc/prune-noblock into master

To mitigate the impact of removing tableflip we need both startup and shutdown of Gitaly processes to be as fast as possible. With 105f6dd8 (cgroups: Create repository cgroups on-demand, 2023-10-26) we improved startup times by creating cgroups individually when needed, rather than as a blocking task during startup.

We currently block shutdown while removing our existing cgroups. This is as slow as cgroup creation, taking up to 20 seconds to remove 1000 cgroups on hosts with large number cgroups.

We can avoid this delay by skipping this step entirely. Gitaly is already removing cgroups from previous Gitaly processes during startup which we can rely on to perform this cleanup.

Also, run cgroup pruning to a goroutine and move it and other async startup tasks to the end of startup to prevent contention against the main thread.

Edited by Will Chandler (ex-GitLab)

Merge request reports