diff --git a/Socket-Manager-and-Resource-Allocation.md b/Socket-Manager-and-Resource-Allocation.md new file mode 100644 index 0000000..8d9fec9 --- /dev/null +++ b/Socket-Manager-and-Resource-Allocation.md @@ -0,0 +1,62 @@ +## 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..size`** + Returns active connection count within the specified category index. + +* **`system.sockets..max_size`** + Returns current operational ceiling assigned to the category by the last rebalance loop. + +* **`system.sockets..min_alloc`** + Returns configured lower allocation floor constraint for the target category. + +* **`system.sockets..max_alloc`** + Returns configured upper allocation ceiling constraint for the target category. + +* **`system.sockets..min_alloc.set`** + Sets the minimum allocation floor parameter. Non-functional for index 0. Does not trigger immediate rebalance. + +* **`system.sockets..max_alloc.set`** + Sets the maximum allocation ceiling parameter. Non-functional for index 0. Does not trigger immediate rebalance. + + +## Categories + +* **`generic`** (Index 0) + Peer connections and uncategorized connections. Constraints are immutable. + +* **`http`** + libcurl HTTP connections. + +* **`internal`** + DHT, UDP trackers, internal thread interrupt signals, and BitTorrent listen sockets. + +* **`scgi`** + SCGI transport layers and RPC interface backends. + +* **`files`** + File descriptors, including memory-mapped filesystem operations (`mmap`). + + +## Examples + +```ini +# 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 = +```