From dfe5392543ac62101cc05c6c8534f76a2c3b448b Mon Sep 17 00:00:00 2001 From: Simon Gardling Date: Mon, 2 Mar 2026 14:22:17 -0500 Subject: [PATCH] qbt: delete incomplete subvolume + tweaks --- configuration.nix | 3 +++ services/qbittorrent.nix | 26 ++++++++++++++++++++------ 2 files changed, 23 insertions(+), 6 deletions(-) diff --git a/configuration.nix b/configuration.nix index 61ecae2..e1f3adb 100644 --- a/configuration.nix +++ b/configuration.nix @@ -157,6 +157,9 @@ # Higher backlog for the large number of concurrent torrent connections "net.core.netdev_max_backlog" = 5000; + # Faster cleanup of dead connections from torrent peer churn + "net.ipv4.tcp_fin_timeout" = 15; # default 60 + "net.ipv4.tcp_tw_reuse" = 1; # Minecraft server optimizations # Disable autogroup for better scheduling of game server threads diff --git a/services/qbittorrent.nix b/services/qbittorrent.nix index 7b8658d..3bbf36f 100644 --- a/services/qbittorrent.nix +++ b/services/qbittorrent.nix @@ -10,8 +10,6 @@ imports = [ (lib.serviceMountWithZpool "qbittorrent" service_configs.zpool_hdds [ service_configs.torrents_path - config.services.qbittorrent.serverConfig.Preferences.Downloads.TempPath - ]) (lib.serviceMountWithZpool "qbittorrent" service_configs.zpool_ssds [ "${config.services.qbittorrent.profileDir}/qBittorrent" @@ -55,12 +53,12 @@ serverConfig.BitTorrent = { Session = { - MaxConnectionsPerTorrent = 50; - MaxUploadsPerTorrent = 10; + MaxConnectionsPerTorrent = 100; + MaxUploadsPerTorrent = 15; MaxConnections = -1; MaxUploads = -1; - MaxActiveCheckingTorrents = 5; + MaxActiveCheckingTorrents = 2; # reduce disk pressure from concurrent hash checks # queueing QueueingSystemEnabled = true; @@ -91,7 +89,7 @@ inherit (config.services.qbittorrent.serverConfig.Preferences.Downloads) TempPath; TempPathEnabled = true; - ConnectionSpeed = 200; + ConnectionSpeed = 30; # Automatic Torrent Management: use category save paths for new torrents DisableAutoTMMByDefault = false; @@ -102,6 +100,22 @@ PieceExtentAffinity = true; SuggestMode = true; CoalesceReadWrite = true; + + # max_queued_disk_bytes: the max bytes waiting in the disk I/O queue. + # When this limit is reached, peer connections stop reading from their + # sockets until the disk thread catches up -- causing the spike-then-zero + # pattern. Default is 1MB; high_performance_seed() uses 7MB. + # 64MB is above the preset but justified for slow raidz1 HDD random writes + # where ZFS txg commits cause periodic I/O stalls. + DiskQueueSize = 67108864; # 64MB + + # === Network buffer tuning (from libtorrent high_performance_seed preset) === + # "always stuff at least 1 MiB down each peer pipe, to quickly ramp up send rates" + SendBufferLowWatermark = 1024; # 1MB (KiB) -- matches high_performance_seed + # "of 500 ms, and a send rate of 4 MB/s, the upper limit should be 2 MB" + SendBufferWatermark = 3072; # 3MB (KiB) -- matches high_performance_seed + # "put 1.5 seconds worth of data in the send buffer" + SendBufferWatermarkFactor = 150; # percent -- matches high_performance_seed }; Network = {