Merge pull request #274110 from networkException/sysctl-net.core.wmem_max
nixos/{sysctl,caddy}: improvements for net.core.wmem_max
This commit is contained in:
@@ -21,19 +21,27 @@ in
|
||||
options = {
|
||||
|
||||
boot.kernel.sysctl = mkOption {
|
||||
type = types.submodule {
|
||||
type = let
|
||||
highestValueType = types.ints.unsigned // {
|
||||
merge = loc: defs:
|
||||
foldl
|
||||
(a: b: if b.value == null then null else lib.max a b.value)
|
||||
0
|
||||
(filterOverrides defs);
|
||||
};
|
||||
in types.submodule {
|
||||
freeformType = types.attrsOf sysctlOption;
|
||||
options."net.core.rmem_max" = mkOption {
|
||||
type = types.nullOr types.ints.unsigned // {
|
||||
merge = loc: defs:
|
||||
foldl
|
||||
(a: b: if b.value == null then null else lib.max a b.value)
|
||||
0
|
||||
(filterOverrides defs);
|
||||
};
|
||||
type = types.nullOr highestValueType;
|
||||
default = null;
|
||||
description = lib.mdDoc "The maximum socket receive buffer size. In case of conflicting values, the highest will be used.";
|
||||
};
|
||||
|
||||
options."net.core.wmem_max" = mkOption {
|
||||
type = types.nullOr highestValueType;
|
||||
default = null;
|
||||
description = lib.mdDoc "The maximum socket send buffer size. In case of conflicting values, the highest will be used.";
|
||||
};
|
||||
};
|
||||
default = {};
|
||||
example = literalExpression ''
|
||||
|
||||
@@ -434,7 +434,7 @@ in
|
||||
# at least up to the values hardcoded here:
|
||||
(mkIf cfg.settings.utp-enabled {
|
||||
"net.core.rmem_max" = mkDefault 4194304; # 4MB
|
||||
"net.core.wmem_max" = mkDefault "1048576"; # 1MB
|
||||
"net.core.wmem_max" = mkDefault 1048576; # 1MB
|
||||
})
|
||||
(mkIf cfg.performanceNetParameters {
|
||||
# Increase the number of available source (local) TCP and UDP ports to 49151.
|
||||
|
||||
@@ -342,8 +342,9 @@ in
|
||||
}
|
||||
'';
|
||||
|
||||
# https://github.com/lucas-clemente/quic-go/wiki/UDP-Receive-Buffer-Size
|
||||
# https://github.com/quic-go/quic-go/wiki/UDP-Buffer-Sizes
|
||||
boot.kernel.sysctl."net.core.rmem_max" = mkDefault 2500000;
|
||||
boot.kernel.sysctl."net.core.wmem_max" = mkDefault 2500000;
|
||||
|
||||
systemd.packages = [ cfg.package ];
|
||||
systemd.services.caddy = {
|
||||
|
||||
Reference in New Issue
Block a user