Skip to content

Commit

Permalink
Add information about upstreams configuration in options.inc (#758)
Browse files Browse the repository at this point in the history
* Update options.md

* Update upstream.md

* Fix grammar

---------

Co-authored-by: moisseev <[email protected]>
  • Loading branch information
dragoangel and moisseev authored Jun 9, 2024
1 parent a5cce63 commit 0a1aeed
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
14 changes: 12 additions & 2 deletions doc/configuration/options.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ dns {
sockets = 16;
retransmits = 5;
}
upstream {
resolve_min_interval = 60;
}
tempdir = "/tmp";
url_tld = "${PLUGINSDIR}/effective_tld_names.dat";
classify_headers = [
Expand Down Expand Up @@ -199,6 +202,13 @@ neighbours {
}
~~~

## Upstream options
## Upstreams options

Upstreams logic and settings are described in the dedicated [document]({{ site.baseurl }}/doc/configuration/upstream.html).
Options for upstreams fall under a dedicated subsection called `upstream` and control their behaviors in Rspamd. Here is a list of available tunables:

See [this document]({{ site.baseurl }}/doc/configuration/upstream.html) for details.
* `error_time` (defaults to `10`): timeframe to check errors in seconds
* `max_errors` (defaults to `4`): maximum count of errors during `error_time` to consider the upstream as down
* `revive_time` (defaults to `60`): count of seconds before attempting to recover upstream after it has faced `max_errors` and has been marked as unhealthy
* `lazy_resolve_time` (defaults to `3600`, which is 1 hour): time in seconds to resolve upstream addresses in lazy mode
* `resolve_min_interval` (defaults to `60`): minimum interval in seconds to perform resolving upstream DNS resolution
6 changes: 4 additions & 2 deletions doc/configuration/upstream.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,10 @@ When an upstream reaches the error rate limit, Rspamd marks it as inactive and w

<img class="img-fluid" width="75%" src="{{ site.baseurl }}/img/upstreams.png">

To tune these settings, please see the [Upstream options]({{ site.baseurl }}/doc/configuration/options.html#upstreams-options) documentation.

## Name resolution

Rspamd treats upstreams defined with their names differently. During the `revive_time`, Rspamd attempts to re-resolve these names and inserts any new IP addresses into the upstream list. If a name has multiple addresses, Rspamd includes all of them. The addresses are then selected using round-robin rotation with error checking. Unlike upstream configurations, errors are persistent and not cleared after successful attempts. Therefore, Rspamd always selects an address with a lower error count. This approach is taken to disable an IPv6 address, for example, if IPv6 is improperly configured in the system.
Rspamd treats upstreams defined with their names differently. During the `revive_time`, Rspamd attempts to re-resolve these names and inserts any new IP addresses into the upstream list. The minimum interval between resolve attempts is controlled by `resolve_min_interval`, which is by default set to 1 minute. If a name has multiple addresses, Rspamd includes all of them. The addresses are then selected using round-robin rotation with error checking. Unlike upstream configurations, errors are persistent and not cleared after successful attempts. Therefore, Rspamd always selects an address with a lower error count. This approach is taken to disable an IPv6 address, for example, if IPv6 is improperly configured in the system.

Starting from version 2.0, Rspamd also performs background resolution of all upstreams every `lazy_resolve_time` + `jitter(0.1 * lazy_resolve_time)`. By default, this value is set to 1 hour, but you can customize it in the configuration (options -> upstreams section). This allows Rspamd to update its knowledge of upstream IP addresses, ensuring efficient and reliable connections. SRV based upstreams are resolved in two steps: one for SRV record resolution and one for targets resolution.
Starting from version 2.0, Rspamd also performs background resolution of all upstreams every `lazy_resolve_time` + `jitter(0.1 * lazy_resolve_time)`. By default, this value is set to 1 hour, but you can customize it in the configuration (options -> upstreams section). This allows Rspamd to update its knowledge of upstream IP addresses, ensuring efficient and reliable connections. SRV-based upstreams are resolved in two steps: one for SRV record resolution and one for target resolution.

0 comments on commit 0a1aeed

Please sign in to comment.