From 466fe7321d9abe3612258671e2f13a1a65d1bf00 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 18 Jan 2026 15:42:18 -0600 Subject: docs --- docs/config.md | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'docs') diff --git a/docs/config.md b/docs/config.md index 2f8bdb1e..02f8abdb 100644 --- a/docs/config.md +++ b/docs/config.md @@ -979,6 +979,28 @@ retention: logs: 180 # days ``` +# Throttling + +> [!WARNING] +> **Application Stability Risk**: The options in this section control the behavior of the application at the limits of the hosting environment's performance. Increasing values can result in unintended behavior and crashes. Support for users that increase these values will be limited. + +slskd is a multi-threaded application and the logic is highly concurrent, but is mostly bound by disk and network I/O rather than CPU. + +The `concurrency` option controls how many threads (.NET `Task`s to be specific) can perform work at the same time, limiting I/O contention. Raising the number _can_ improve throughput on capable machines but defaults are generally set in such a way that improvements will be negligible. Lowering the number will reduce throughput but alleviate I/O contention and improve stability on lower-spec hardware. + +Lower values of `concurrency` or slow processing of individual messages may cause the application to process messages at a slower rate than they are received, causing messages to be 'backed up' in internal queues. The `circuit_breaker` option controls the number of messages that can be enqueued. Once the circuit breaker is hit, the application will drop or discard messages without processing them. + +The latency, queue depth and rate at which messages are being dropped can be monitored by reviewing the application state or Prometheus metrics. + +#### **YAML** +```yaml +throttling: + search: + response: + concurrency: 10 # number of search requests to process at the same time + circuit_breaker: 500 # maximum number of pending search requests +``` + # Integrations ## User-Defined -- cgit v1.2.3 From fa39c123a67351e6d55d9fa04fd662a6b27f0481 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 18 Jan 2026 17:17:42 -0600 Subject: add command line args --- docs/config.md | 13 ++++++++++--- src/slskd/Core/Options.cs | 3 +++ 2 files changed, 13 insertions(+), 3 deletions(-) (limited to 'docs') diff --git a/docs/config.md b/docs/config.md index 02f8abdb..f75a1335 100644 --- a/docs/config.md +++ b/docs/config.md @@ -471,7 +471,7 @@ Users added to the blacklist will be blocked from enqueueing any new files. Any A managed blacklist file may also be used to achieve the same effects. Read more about this in the [Managed Blacklist](#managed-blacklist) section below. -**YAML** +#### **YAML** ```yaml groups: blacklisted: @@ -640,7 +640,7 @@ Child connections should generally only be disabled on low spec systems or situa Depending on the current state, changing these values may require the server connection to be reset. | Command-Line | Environment Variable | Description | -| ------------------------- | ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| ------------------------- | ----------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | `--slsk-no-dnet` | `SLSKD_SLSK_NO_DNET` | Determines whether the distributed network is disabled. If disabled, the client will not obtain a parent or any child connections, and will not receive distributed search requests. | | `--slsk-dnet-no-children` | `SLSKD_SLSK_DNET_NO_CHILDREN` | Determines whether to disallow distributed children | | `--slsk-dnet-children` | `SLSKD_SLSK_DNET_CHILDREN` | The maximum number of distributed children to accept | @@ -992,13 +992,20 @@ Lower values of `concurrency` or slow processing of individual messages may caus The latency, queue depth and rate at which messages are being dropped can be monitored by reviewing the application state or Prometheus metrics. +| Command Line | Environment Variable | Description | +| -------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | +| `--throttling-search-incoming-concurrency` | `SLSKD_THROTTING_SEARCH_INCOMING_CONCURRENCY` | The limit for the number of concurrent search response operations | +| `--throttling-search-incoming-circuit-breaker` | `SLSKD_THROTTING_SEARCH_INCOMING_CIRCUIT_BREAKER` | The limit for the number of queued search response operations, after which requests will be discarded | +| `--throttling-search-incoming-response-file-limit` | `SLSKD_THROTTING_SEARCH_INCOMING_RESPONSE_FILE_LIMIT` | The limit for the number of files that can be returned in a single search request | + #### **YAML** ```yaml throttling: search: - response: + incoming: concurrency: 10 # number of search requests to process at the same time circuit_breaker: 500 # maximum number of pending search requests + file_limit: 500 # maximum number of files to return in a single search response ``` # Integrations diff --git a/src/slskd/Core/Options.cs b/src/slskd/Core/Options.cs index e37a9446..7021f808 100644 --- a/src/slskd/Core/Options.cs +++ b/src/slskd/Core/Options.cs @@ -1497,6 +1497,7 @@ namespace slskd /// /// Gets the limit for the number of concurrent search response operations. /// + [Argument(default, "throttling-search-incoming-concurrency")] [EnvironmentVariable("THROTTLING_SEARCH_INCOMING_CONCURRENCY")] [Range(1, 100)] [RequiresRestart] @@ -1505,6 +1506,7 @@ namespace slskd /// /// Gets the limit for the number of queued search response operations, after which requests will be discarded. /// + [Argument(default, "throttling-search-incoming-circuit-breaker")] [EnvironmentVariable("THROTTLING_SEARCH_INCOMING_CIRCUIT_BREAKER")] [Range(100, 10000)] [RequiresRestart] @@ -1513,6 +1515,7 @@ namespace slskd /// /// Gets the limit for the number of files that can be returned in a single search request. /// + [Argument(default, "throttling-search-incoming-response-file-limit")] [EnvironmentVariable("THROTTLING_SEARCH_INCOMING_RESPONSE_FILE_LIMIT")] [Range(100, 5000)] public int ResponseFileLimit { get; init; } = 500; -- cgit v1.2.3 From 66a68fa862d7be163add3f9d3befefe3cf154e6e Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 19 Jan 2026 12:12:47 -0600 Subject: Update docs/config.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/config.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'docs') diff --git a/docs/config.md b/docs/config.md index f75a1335..b3f81a1f 100644 --- a/docs/config.md +++ b/docs/config.md @@ -992,11 +992,11 @@ Lower values of `concurrency` or slow processing of individual messages may caus The latency, queue depth and rate at which messages are being dropped can be monitored by reviewing the application state or Prometheus metrics. -| Command Line | Environment Variable | Description | -| -------------------------------------------------- | ----------------------------------------------------- | ----------------------------------------------------------------------------------------------------- | -| `--throttling-search-incoming-concurrency` | `SLSKD_THROTTING_SEARCH_INCOMING_CONCURRENCY` | The limit for the number of concurrent search response operations | -| `--throttling-search-incoming-circuit-breaker` | `SLSKD_THROTTING_SEARCH_INCOMING_CIRCUIT_BREAKER` | The limit for the number of queued search response operations, after which requests will be discarded | -| `--throttling-search-incoming-response-file-limit` | `SLSKD_THROTTING_SEARCH_INCOMING_RESPONSE_FILE_LIMIT` | The limit for the number of files that can be returned in a single search request | +| Command Line | Environment Variable | Description | +| -------------------------------------------------- | ------------------------------------------------------ | ----------------------------------------------------------------------------------------------------- | +| `--throttling-search-incoming-concurrency` | `SLSKD_THROTTLING_SEARCH_INCOMING_CONCURRENCY` | The limit for the number of concurrent search response operations | +| `--throttling-search-incoming-circuit-breaker` | `SLSKD_THROTTLING_SEARCH_INCOMING_CIRCUIT_BREAKER` | The limit for the number of queued search response operations, after which requests will be discarded | +| `--throttling-search-incoming-response-file-limit` | `SLSKD_THROTTLING_SEARCH_INCOMING_RESPONSE_FILE_LIMIT` | The limit for the number of files that can be returned in a single search request | #### **YAML** ```yaml -- cgit v1.2.3 From eab108258e05a494ce8764f94f946c0af7671750 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Mon, 19 Jan 2026 12:13:04 -0600 Subject: Update docs/config.md Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- docs/config.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'docs') diff --git a/docs/config.md b/docs/config.md index b3f81a1f..9836a063 100644 --- a/docs/config.md +++ b/docs/config.md @@ -1005,7 +1005,7 @@ throttling: incoming: concurrency: 10 # number of search requests to process at the same time circuit_breaker: 500 # maximum number of pending search requests - file_limit: 500 # maximum number of files to return in a single search response + response_file_limit: 500 # maximum number of files to return in a single search response ``` # Integrations -- cgit v1.2.3