Skip to content

Commit

Permalink
nixos/redis: Disable hugepages for redis via sysctl and not via a sys…
Browse files Browse the repository at this point in the history
…temd-oneshot
  • Loading branch information
maralorn committed Oct 21, 2019
1 parent 2695914 commit fe143ba
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions nixos/modules/services/databases/redis.nix
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,9 @@ in

config = mkIf config.services.redis.enable {

boot.kernel.sysctl = mkIf cfg.vmOverCommit {
"vm.overcommit_memory" = "1";
};
boot.kernel.sysctl = {
"vm.nr_hugepages" = "0";
} // mkIf cfg.vmOverCommit { "vm.overcommit_memory" = "1"; };

networking.firewall = mkIf cfg.openFirewall {
allowedTCPPorts = [ cfg.port ];
Expand All @@ -198,14 +198,6 @@ in

environment.systemPackages = [ cfg.package ];

systemd.services.disable-transparent-huge-pages = {
description = "Disable Transparent Huge Pages (required by Redis)";
before = [ "redis.service" ];
wantedBy = [ "redis.service" ];
script = "echo never > /sys/kernel/mm/transparent_hugepage/enabled";
serviceConfig.Type = "oneshot";
};

systemd.services.redis =
{ description = "Redis Server";

Expand Down

0 comments on commit fe143ba

Please sign in to comment.