Merge pull request #67768 from peti/t/redis

nixos/redis: disable transparent huge pages (TLP) before starting Redis
This commit is contained in:
Peter Simons 2019-09-01 08:49:25 +02:00 committed by GitHub
commit 0808f5ad1d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -40,7 +40,12 @@ in
enable = mkOption {
type = types.bool;
default = false;
description = "Whether to enable the Redis server.";
description = ''
Whether to enable the Redis server. Note that the NixOS module for
Redis disables kernel support for Transparent Huge Pages (THP),
because this features causes major performance problems for Redis,
e.g. (https://redis.io/topics/latency).
'';
};
package = mkOption {
@ -224,6 +229,16 @@ in
environment.systemPackages = [ cfg.package ];
systemd.services.disable-transparent-huge-pages = {
enable = config.services.redis.enable;
description = "Disable Transparent Huge Pages (required by Redis)";
after = [ "sysinit.target" "local-fs.target" ];
before = [ "redis.service" ];
wantedBy = [ "redis.service" ];
script = "echo never >/sys/kernel/mm/transparent_hugepage/enabled";
serviceConfig.Type = "oneshot";
};
systemd.services.redis =
{ description = "Redis Server";