diff options
author | talyz <kim.lindberger@gmail.com> | 2021-04-01 19:47:27 +0200 |
---|---|---|
committer | talyz <kim.lindberger@gmail.com> | 2021-04-10 10:49:18 +0200 |
commit | 6230936be276cd02e1e21e22ad0845582d098399 (patch) | |
tree | 954e4eb617ed30aef23e9a1060964b1e7cdb365b /nixos/modules/services/misc/gitlab.nix | |
parent | 9af991a1b1f02cfda10a152c0e4f193e424cf10f (diff) | |
download | nixpkgs-6230936be276cd02e1e21e22ad0845582d098399.tar nixpkgs-6230936be276cd02e1e21e22ad0845582d098399.tar.gz nixpkgs-6230936be276cd02e1e21e22ad0845582d098399.tar.bz2 nixpkgs-6230936be276cd02e1e21e22ad0845582d098399.tar.lz nixpkgs-6230936be276cd02e1e21e22ad0845582d098399.tar.xz nixpkgs-6230936be276cd02e1e21e22ad0845582d098399.tar.zst nixpkgs-6230936be276cd02e1e21e22ad0845582d098399.zip |
nixos/gitlab: Add options to control puma worker and threads numbers
Diffstat (limited to 'nixos/modules/services/misc/gitlab.nix')
-rw-r--r-- | nixos/modules/services/misc/gitlab.nix | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/nixos/modules/services/misc/gitlab.nix b/nixos/modules/services/misc/gitlab.nix index f86653f3ead..c2b8cbfbd76 100644 --- a/nixos/modules/services/misc/gitlab.nix +++ b/nixos/modules/services/misc/gitlab.nix @@ -652,6 +652,62 @@ in { description = "Extra configuration to merge into shell-config.yml"; }; + puma.workers = mkOption { + type = types.int; + default = 2; + apply = x: builtins.toString x; + description = '' + The number of worker processes Puma should spawn. This + controls the amount of parallel Ruby code can be + executed. GitLab recommends <quote>Number of CPU cores - + 1</quote>, but at least two. + + <note> + <para> + Each worker consumes quite a bit of memory, so + be careful when increasing this. + </para> + </note> + ''; + }; + + puma.threadsMin = mkOption { + type = types.int; + default = 0; + apply = x: builtins.toString x; + description = '' + The minimum number of threads Puma should use per + worker. + + <note> + <para> + Each thread consumes memory and contributes to Global VM + Lock contention, so be careful when increasing this. + </para> + </note> + ''; + }; + + puma.threadsMax = mkOption { + type = types.int; + default = 4; + apply = x: builtins.toString x; + description = '' + The maximum number of threads Puma should use per + worker. This limits how many threads Puma will automatically + spawn in response to requests. In contrast to workers, + threads will never be able to run Ruby code in parallel, but + give higher IO parallelism. + + <note> + <para> + Each thread consumes memory and contributes to Global VM + Lock contention, so be careful when increasing this. + </para> + </note> + ''; + }; + extraConfig = mkOption { type = types.attrs; default = {}; @@ -1145,7 +1201,13 @@ in { TimeoutSec = "infinity"; Restart = "on-failure"; WorkingDirectory = "${cfg.packages.gitlab}/share/gitlab"; - ExecStart = "${cfg.packages.gitlab.rubyEnv}/bin/puma -C ${cfg.statePath}/config/puma.rb -e production"; + ExecStart = concatStringsSep " " [ + "${cfg.packages.gitlab.rubyEnv}/bin/puma" + "-e production" + "-C ${cfg.statePath}/config/puma.rb" + "-w ${cfg.puma.workers}" + "-t ${cfg.puma.threadsMin}:${cfg.puma.threadsMax}" + ]; }; }; |