Skip to content

Socket Manager and Resource Allocation

Jari Sundell edited this page Jun 16, 2026 · 4 revisions

Core Commands

  • system.sockets.size Returns total open, managed socket descriptors.

  • system.sockets.max_size Returns absolute global concurrent socket descriptor limit.

  • system.sockets.max_size.set Sets global socket ceiling and invokes allocation rebalance. Discouraged; file descriptor limits should be defined via operating system ulimit settings.

  • system.sockets.adjust_alloc Triggers immediate runtime resource reallocation and rebalances active category quotas.

  • system.sockets.<category>.size Returns active connection count within the specified category index.

  • system.sockets.<category>.max_size Returns current operational ceiling assigned to the category by the last rebalance loop.

  • system.sockets.<category>.min_alloc Returns configured lower allocation floor constraint for the target category.

  • system.sockets.<category>.max_alloc Returns configured upper allocation ceiling constraint for the target category.

  • system.sockets.<category>.min_alloc.set Sets the minimum allocation floor parameter. Non-functional for index 0. Does not trigger immediate rebalance.

  • system.sockets.<category>.max_alloc.set Sets the maximum allocation ceiling parameter. Non-functional for index 0. Does not trigger immediate rebalance.

Categories

  • generic Peer connections and uncategorized connections. This category does not have min/max_alloc as it receives the remaining allocation.

  • http HTTP connections.

  • internal DHT, UDP trackers, listening and various internal sockets.

  • rpc RPC related sockets.

  • files File descriptors.

Default Allocation Constraints

open_max generic minimum reserved http internal rpc files
$\ge$ 32768 12288 512 128 64 64 4096
16384 to 32767 12288 512 128 64 64 2048
8096 to 16383 6144 256 64 32 48 1024
1024 to 8095 512 128 32 32 32 128
< 1024 256 64 16 16 16 64

The baseline descriptor limits for each socket category are auto-calculated at startup (using ulimit -n) or when calling adjust_alloc (using system.sockets.max_size).

Allocation to other categories result in generic receiving less than generic minimum an internal_error is thrown.

Examples

# Increase allocation to the files category, e.g. if max_open is 16k it would be 2048.
system.sockets.files.min_alloc.set=4096
system.sockets.adjust_alloc=

# Restrict to 512 if you have mostly single-file torrents and want more peer connections.
system.sockets.files.max_alloc.set=512
system.sockets.adjust_alloc=

Clone this wiki locally