`estuary`'s port in ColoClue DC6 loses bursts of packets whenever the members switch floods other members' traffic to it. CUBIC treats each burst as congestion and takes 20-30 s to recover, longer than the gap between floods. BBR keeps going. Between `estuary` and `river`, it averaged 899 Mbit/s against CUBIC's 258 Mbit/s downloading from colony, and 185 against 149 Mbit/s uploading to it. Add a `my.network.bbr` option. Congestion control is chosen by the sender, so enable it on the colony boxes that send data off-box (`colony`, `shill` and its `middleman` proxy, `git`, `whale2`), and for uploads on `castle` and the home routers. Forwarded traffic isn't affected, so the routers only gain for their own connections and `estuary` is left alone. BBR paces itself, so the default qdisc stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
53 lines
1.6 KiB
Nix
53 lines
1.6 KiB
Nix
{ lib, pkgs, config, ... }:
|
|
let
|
|
inherit (lib) flatten optional mkIf mkDefault mkMerge versionAtLeast;
|
|
inherit (lib.my) mkBoolOpt';
|
|
|
|
cfg = config.my.network;
|
|
in
|
|
{
|
|
options.my.network.bbr = mkBoolOpt' false
|
|
("Whether to use BBR congestion control for TCP connections this box sends. Unlike the default " +
|
|
"(CUBIC), BBR doesn't treat packet loss as congestion, so it keeps throughput up on lossy paths. " +
|
|
"It has no effect on traffic the box forwards.");
|
|
|
|
config = mkMerge [
|
|
{
|
|
networking = {
|
|
domain = mkDefault "int.${lib.my.c.pubDomain}";
|
|
useDHCP = false;
|
|
enableIPv6 = mkDefault true;
|
|
useNetworkd = mkDefault true;
|
|
};
|
|
|
|
services.resolved = {
|
|
settings.Resolve = {
|
|
Domains = [ config.networking.domain ];
|
|
# Explicitly unset fallback DNS (Nix module will not allow for a blank config)
|
|
FallbackDNS = "";
|
|
Cache = "no-negative";
|
|
};
|
|
};
|
|
}
|
|
|
|
(mkIf cfg.bbr {
|
|
# BBR paces its own sending, so the default qdisc (fq_codel) stays as it is. A container's
|
|
# network namespace copies the host's setting only when it's created, so enable this in
|
|
# containers too for it to apply without a restart.
|
|
boot = {
|
|
kernelModules = [ "tcp_bbr" ];
|
|
kernel.sysctl."net.ipv4.tcp_congestion_control" = "bbr";
|
|
};
|
|
})
|
|
|
|
(mkIf config.my.build.isDevVM {
|
|
networking.interfaces.eth0.useDHCP = mkDefault true;
|
|
virtualisation = {
|
|
forwardPorts = flatten [
|
|
(optional config.services.openssh.openFirewall { from = "host"; host.port = 2222; guest.port = 22; })
|
|
];
|
|
};
|
|
})
|
|
];
|
|
}
|