Best Libtorrent Settings for Gigabit Fiber

High-speed fiber connections provide massive bandwidth, but default libtorrent configurations often throttle throughput due to conservative memory, disk I/O, and networking limits. To fully utilize a gigabit or multi-gigabit fiber connection, you must adjust specific libtorrent parameters related to disk caching, socket buffer sizes, connection limits, and I/O concurrency.

1. Disk Cache and Memory Management

Gigabit download speeds write data faster than standard storage queues can handle without sufficient caching. Increasing the cache buffer reduces disk thrashing and prevents download stalls.

  • cache_size: Set this to a value matching your available RAM. For a 1 Gbps to 2.5 Gbps connection, assign between 32768 (512 MB) and 65536 (1 GB) blocks of 16 KiB each. If your machine has abundant RAM, setting this higher (e.g., 2 GB–4 GB) ensures smooth writes.
  • cache_expiry: Increase to 60 or 120 seconds. This keeps pieces in memory longer, allowing libtorrent to flush sequentially to disk rather than performing random small writes.
  • disk_io_write_mode / disk_io_read_mode: Set to enable_os_cache or use asynchronous disk I/O to offload file buffering to the operating system efficiently.

2. Asynchronous I/O and Disk Threads

Multi-gigabit transfers generate high I/O requests per second. Adjusting thread pools prevents CPU bottlenecks on the disk layer.

  • aio_threads: Increase the number of disk I/O threads. The default is typically 4 or 8. On modern multi-core CPUs with fiber connections and NVMe or SSD drives, increase this value to 16 or 32 to handle parallel disk read/write tasks.
  • checking_mem_usage: Increase this if rechecking large torrents on fast storage to speed up piece validation.

3. Network Socket Buffers and Queue Sizes

Default operating system and libtorrent socket buffers are optimized for lower-bandwidth connections and will drop packets at multi-hundred-megabit rates.

  • recv_socket_buffer_size: Set to at least 1048576 (1 MB) or 2097152 (2 MB) to prevent TCP window exhaustion during high-speed downloads.
  • send_socket_buffer_size: Set to 1048576 (1 MB) or 2097152 (2 MB) to maintain maximum upload saturation.
  • max_out_request_queue: Increase to 1500–3000. Fiber connections have minimal latency and massive bandwidth, requiring larger request pipelines so peers never wait for requests.
  • send_buffer_watermark and send_buffer_low_watermark: Increase these values (e.g., 3145728 / 1048576) to ensure a steady stream of outbound data without stalling.

4. Connection Limits and Peer Management

Fiber connections easily handle thousands of concurrent states, meaning default peer limits will unnecessarily restrict throughput.

  • connections_limit: Raise the global limit to 1000–2000.
  • connections_per_second: Increase to 50–100 to ramp up to full download speeds much faster.
  • unchoke_slots_limit: Increase to 50–100 or set to -1 (dynamic based on upload capacity). Fiber connections have symmetric or high upload capability; opening more unchoke slots allows you to trade pieces with more high-speed peers simultaneously.
  • peer_connect_timeout: Lower slightly (e.g., 15 seconds) to drop unresponsive peers faster and connect to faster nodes.

5. Transport Protocol and Overhead Tuning

The Micro Transport Protocol (uTP) throttles transfer rates when it detects minor latency spikes. On high-speed links, this often causes false-positive rate drops and heavy CPU usage.

  • mixed_mode_algorithm: Set to prefer_tcp to ensure libtorrent prioritizes standard TCP over uTP.
  • rate_limit_utp: Disable or set to false if you experience CPU spikes, as pure TCP handles gigabit throughput with significantly less CPU overhead.
  • enable_incoming_utp / enable_outgoing_utp: If standard TCP connections are not blocked by your ISP, disabling uTP entirely can reduce CPU utilization at speeds above 1 Gbps.