Merge pull request #301064 from SuperSandro2000/redis-thp

nixos/redis: enable vmOverCommit by defaul; don't disable transparent hugepages
This commit is contained in:
Florian Klink 2024-04-29 14:27:12 +03:00 committed by GitHub
commit d77b0cf4f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 deletions

View File

@ -293,6 +293,8 @@ The pre-existing [services.ankisyncd](#opt-services.ankisyncd.enable) has been m
- `network-interfaces.target` system target was removed as it has been deprecated for a long time. Use `network.target` instead.
- `services.redis.vmOverCommit` now defaults to `true` and no longer enforces Transparent Hugepages (THP) to be disabled. Redis only works with THP configured to `madvise` which is the kernel's default.
- `azure-cli` now has extension support. For example, to install the `aks-preview` extension, use
```nix

View File

@ -57,9 +57,9 @@ in {
package = mkPackageOption pkgs "redis" { };
vmOverCommit = mkEnableOption ''
setting of vm.overcommit_memory to 1
set `vm.overcommit_memory` sysctl to 1
(Suggested for Background Saving: <https://redis.io/docs/get-started/faq/>)
'';
'' // { default = true; };
servers = mkOption {
type = with types; attrsOf (submodule ({ config, name, ... }: {
@ -312,10 +312,9 @@ in {
'';
}) enabledServers);
boot.kernel.sysctl = mkMerge [
{ "vm.nr_hugepages" = "0"; }
( mkIf cfg.vmOverCommit { "vm.overcommit_memory" = "1"; } )
];
boot.kernel.sysctl = mkIf cfg.vmOverCommit {
"vm.overcommit_memory" = "1";
};
networking.firewall.allowedTCPPorts = concatMap (conf:
optional conf.openFirewall conf.port