Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 6acb6d7

Browse files
authored
Update worker docs to update preferred settings for pusher and federation_sender (#14493)
* Fix one typo on line 3700(and apparently do something to other lines, no idea) * Update config_documentation.md with more information about how federation_senders and pushers settings can be handled. Specifically, that the instance map style of config does not require the special other variables that enable and disable functionality and that a single worker CAN be added to the map not only just two or more. * Extra line here for consistency and appearance. * Add link to sygnal repo. * Add deprecation notice to workers.md and point to the newer alternative method of defining this functionality. * Changelog * Correct version number of Synapse the deprecation is happening in. * Update quiet deprecation with simple notice and suggestion.
1 parent 656dce4 commit 6acb6d7

File tree

3 files changed

+53
-31
lines changed

3 files changed

+53
-31
lines changed

changelog.d/14493.doc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Update worker settings for `pusher` and `federation_sender` functionality.

docs/usage/configuration/config_documentation.md

Lines changed: 44 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -858,7 +858,7 @@ which are older than the room's maximum retention period. Synapse will also
858858
filter events received over federation so that events that should have been
859859
purged are ignored and not stored again.
860860

861-
The message retention policies feature is disabled by default. Please be advised
861+
The message retention policies feature is disabled by default. Please be advised
862862
that enabling this feature carries some risk. There are known bugs with the implementation
863863
which can cause database corruption. Setting retention to delete older history
864864
is less risky than deleting newer history but in general caution is advised when enabling this
@@ -3003,7 +3003,7 @@ Options for each entry include:
30033003
which is set to the claims returned by the UserInfo Endpoint and/or
30043004
in the ID Token.
30053005

3006-
* `backchannel_logout_enabled`: set to `true` to process OIDC Back-Channel Logout notifications.
3006+
* `backchannel_logout_enabled`: set to `true` to process OIDC Back-Channel Logout notifications.
30073007
Those notifications are expected to be received on `/_synapse/client/oidc/backchannel_logout`.
30083008
Defaults to `false`.
30093009

@@ -3425,7 +3425,7 @@ This option has the following sub-options:
34253425
NB. If you set this to true, and the last time the user_directory search
34263426
indexes were (re)built was before Synapse 1.44, you'll have to
34273427
rebuild the indexes in order to search through all known users.
3428-
3428+
34293429
These indexes are built the first time Synapse starts; admins can
34303430
manually trigger a rebuild via the API following the instructions
34313431
[for running background updates](../administration/admin_api/background_updates.md#run),
@@ -3684,7 +3684,7 @@ As a result, the worker configuration is divided into two parts.
36843684

36853685
1. The first part (in this section of the manual) defines which shardable tasks
36863686
are delegated to privileged workers. This allows unprivileged workers to make
3687-
request a privileged worker to act on their behalf.
3687+
requests to a privileged worker to act on their behalf.
36883688
1. [The second part](#individual-worker-configuration)
36893689
controls the behaviour of individual workers in isolation.
36903690

@@ -3696,7 +3696,7 @@ For guidance on setting up workers, see the [worker documentation](../../workers
36963696
A shared secret used by the replication APIs on the main process to authenticate
36973697
HTTP requests from workers.
36983698

3699-
The default, this value is omitted (equivalently `null`), which means that
3699+
The default, this value is omitted (equivalently `null`), which means that
37003700
traffic between the workers and the main process is not authenticated.
37013701

37023702
Example configuration:
@@ -3706,6 +3706,8 @@ worker_replication_secret: "secret_secret"
37063706
---
37073707
### `start_pushers`
37083708

3709+
Unnecessary to set if using [`pusher_instances`](#pusher_instances) with [`generic_workers`](../../workers.md#synapseappgeneric_worker).
3710+
37093711
Controls sending of push notifications on the main process. Set to `false`
37103712
if using a [pusher worker](../../workers.md#synapseapppusher). Defaults to `true`.
37113713

@@ -3716,25 +3718,30 @@ start_pushers: false
37163718
---
37173719
### `pusher_instances`
37183720

3719-
It is possible to run multiple [pusher workers](../../workers.md#synapseapppusher),
3720-
in which case the work is balanced across them. Use this setting to list the pushers by
3721-
[`worker_name`](#worker_name). Ensure the main process and all pusher workers are
3722-
restarted after changing this option.
3723-
3724-
If no or only one pusher worker is configured, this setting is not necessary.
3725-
The main process will send out push notifications by default if you do not disable
3726-
it by setting [`start_pushers: false`](#start_pushers).
3721+
It is possible to scale the processes that handle sending push notifications to [sygnal](https://github.com/matrix-org/sygnal)
3722+
and email by running a [`generic_worker`](../../workers.md#synapseappgeneric_worker) and adding it's [`worker_name`](#worker_name) to
3723+
a `pusher_instances` map. Doing so will remove handling of this function from the main
3724+
process. Multiple workers can be added to this map, in which case the work is balanced
3725+
across them. Ensure the main process and all pusher workers are restarted after changing
3726+
this option.
37273727

3728-
Example configuration:
3728+
Example configuration for a single worker:
3729+
```yaml
3730+
pusher_instances:
3731+
- pusher_worker1
3732+
```
3733+
And for multiple workers:
37293734
```yaml
3730-
start_pushers: false
37313735
pusher_instances:
37323736
- pusher_worker1
37333737
- pusher_worker2
37343738
```
3739+
37353740
---
37363741
### `send_federation`
37373742

3743+
Unnecessary to set if using [`federation_sender_instances`](#federation_sender_instances) with [`generic_workers`](../../workers.md#synapseappgeneric_worker).
3744+
37383745
Controls sending of outbound federation transactions on the main process.
37393746
Set to `false` if using a [federation sender worker](../../workers.md#synapseappfederation_sender).
37403747
Defaults to `true`.
@@ -3746,29 +3753,36 @@ send_federation: false
37463753
---
37473754
### `federation_sender_instances`
37483755

3749-
It is possible to run multiple
3750-
[federation sender worker](../../workers.md#synapseappfederation_sender), in which
3751-
case the work is balanced across them. Use this setting to list the senders.
3756+
It is possible to scale the processes that handle sending outbound federation requests
3757+
by running a [`generic_worker`](../../workers.md#synapseappgeneric_worker) and adding it's [`worker_name`](#worker_name) to
3758+
a `federation_sender_instances` map. Doing so will remove handling of this function from
3759+
the main process. Multiple workers can be added to this map, in which case the work is
3760+
balanced across them.
37523761

3753-
This configuration setting must be shared between all federation sender workers, and if
3754-
changed all federation sender workers must be stopped at the same time and then
3755-
started, to ensure that all instances are running with the same config (otherwise
3762+
This configuration setting must be shared between all workers handling federation
3763+
sending, and if changed all federation sender workers must be stopped at the same time
3764+
and then started, to ensure that all instances are running with the same config (otherwise
37563765
events may be dropped).
37573766

3758-
Example configuration:
3767+
Example configuration for a single worker:
37593768
```yaml
3760-
send_federation: false
37613769
federation_sender_instances:
37623770
- federation_sender1
37633771
```
3772+
And for multiple workers:
3773+
```yaml
3774+
federation_sender_instances:
3775+
- federation_sender1
3776+
- federation_sender2
3777+
```
37643778
---
37653779
### `instance_map`
37663780

37673781
When using workers this should be a map from [`worker_name`](#worker_name) to the
37683782
HTTP replication listener of the worker, if configured.
3769-
Each worker declared under [`stream_writers`](../../workers.md#stream-writers) needs
3783+
Each worker declared under [`stream_writers`](../../workers.md#stream-writers) needs
37703784
a HTTP replication listener, and that listener should be included in the `instance_map`.
3771-
(The main process also needs an HTTP replication listener, but it should not be
3785+
(The main process also needs an HTTP replication listener, but it should not be
37723786
listed in the `instance_map`.)
37733787

37743788
Example configuration:
@@ -3902,8 +3916,8 @@ worker_replication_http_tls: true
39023916
---
39033917
### `worker_listeners`
39043918

3905-
A worker can handle HTTP requests. To do so, a `worker_listeners` option
3906-
must be declared, in the same way as the [`listeners` option](#listeners)
3919+
A worker can handle HTTP requests. To do so, a `worker_listeners` option
3920+
must be declared, in the same way as the [`listeners` option](#listeners)
39073921
in the shared config.
39083922

39093923
Workers declared in [`stream_writers`](#stream_writers) will need to include a
@@ -3922,7 +3936,7 @@ worker_listeners:
39223936
### `worker_daemonize`
39233937

39243938
Specifies whether the worker should be started as a daemon process.
3925-
If Synapse is being managed by [systemd](../../systemd-with-workers/README.md), this option
3939+
If Synapse is being managed by [systemd](../../systemd-with-workers/README.md), this option
39263940
must be omitted or set to `false`.
39273941

39283942
Defaults to `false`.
@@ -3934,11 +3948,11 @@ worker_daemonize: true
39343948
---
39353949
### `worker_pid_file`
39363950

3937-
When running a worker as a daemon, we need a place to store the
3951+
When running a worker as a daemon, we need a place to store the
39383952
[PID](https://en.wikipedia.org/wiki/Process_identifier) of the worker.
39393953
This option defines the location of that "pid file".
39403954

3941-
This option is required if `worker_daemonize` is `true` and ignored
3955+
This option is required if `worker_daemonize` is `true` and ignored
39423956
otherwise. It has no default.
39433957

39443958
See also the [`pid_file` option](#pid_file) option for the main Synapse process.
@@ -3988,4 +4002,3 @@ background_updates:
39884002
min_batch_size: 10
39894003
default_batch_size: 50
39904004
```
3991-

docs/workers.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,9 @@ worker application type.
505505

506506
### `synapse.app.pusher`
507507

508+
It is likely this option will be deprecated in the future and is not recommended for new
509+
installations. Instead, [use `synapse.app.generic_worker` with the `pusher_instances`](usage/configuration/config_documentation.md#pusher_instances).
510+
508511
Handles sending push notifications to sygnal and email. Doesn't handle any
509512
REST endpoints itself, but you should set
510513
[`start_pushers: false`](usage/configuration/config_documentation.md#start_pushers) in the
@@ -543,6 +546,9 @@ Note this worker cannot be load-balanced: only one instance should be active.
543546

544547
### `synapse.app.federation_sender`
545548

549+
It is likely this option will be deprecated in the future and not recommended for
550+
new installations. Instead, [use `synapse.app.generic_worker` with the `federation_sender_instances`](usage/configuration/config_documentation.md#federation_sender_instances).
551+
546552
Handles sending federation traffic to other servers. Doesn't handle any
547553
REST endpoints itself, but you should set
548554
[`send_federation: false`](usage/configuration/config_documentation.md#send_federation)
@@ -639,7 +645,9 @@ equivalent to `synapse.app.generic_worker`:
639645
* `synapse.app.client_reader`
640646
* `synapse.app.event_creator`
641647
* `synapse.app.federation_reader`
648+
* `synapse.app.federation_sender`
642649
* `synapse.app.frontend_proxy`
650+
* `synapse.app.pusher`
643651
* `synapse.app.synchrotron`
644652

645653

0 commit comments

Comments
 (0)