From 547bf0988ef81edb25fd0783b8d635108f614626 Mon Sep 17 00:00:00 2001 From: anoadragon453 Date: Tue, 3 May 2022 10:52:17 +0000 Subject: deploy: 7e6598bcf6cf63b4d04c27b9696ed8429b6ddff6 --- latest/workers.html | 77 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 55 insertions(+), 22 deletions(-) (limited to 'latest/workers.html') diff --git a/latest/workers.html b/latest/workers.html index f6f10ac7e0..347b4b514a 100644 --- a/latest/workers.html +++ b/latest/workers.html @@ -76,7 +76,7 @@ @@ -250,21 +250,19 @@ replication port. If the worker will handle HTTP requests then the as the listeners option in the shared config.

For example:

worker_app: synapse.app.generic_worker
-worker_name: worker1
+worker_name: generic_worker1
 
 # The replication listener on the main synapse process.
 worker_replication_host: 127.0.0.1
 worker_replication_http_port: 9093
 
 worker_listeners:
- - type: http
-   port: 8083
-   resources:
-     - names:
-       - client
-       - federation
+  - type: http
+    port: 8083
+    resources:
+      - names: [client, federation]
 
-worker_log_config: /home/matrix/synapse/config/worker1_log_config.yaml
+worker_log_config: /etc/matrix-synapse/generic-worker-log.yaml
 

...is a full configuration for a generic worker instance, which will expose a plain HTTP endpoint on port 8083 separately serving various endpoints, e.g. @@ -430,9 +428,9 @@ the full URI, or even just round robin), the room ID is the path component after of events, then a dedicated set of workers can be provisioned to limit the effects of bursts of events from that bridge on events sent by normal users.

Stream writers

-

Additionally, there is experimental support for moving writing of specific -streams (such as events) off of the main process to a particular worker. (This -is only supported with Redis-based replication.)

+

Additionally, the writing of specific streams (such as events) can be moved off +of the main process to a particular worker. +(This is only supported with Redis-based replication.)

To enable this, the worker must have a HTTP replication listener configured, have a worker_name and be listed in the instance_map config. The same worker can handle multiple streams, but unless otherwise documented, each stream can only @@ -447,6 +445,31 @@ configuration would include:

stream_writers: events: event_persister1 +

An example for a stream writer instance:

+
worker_app: synapse.app.generic_worker
+worker_name: event_persister1 
+
+# The replication listener on the main synapse process.
+worker_replication_host: 127.0.0.1
+worker_replication_http_port: 9093
+
+worker_listeners:
+  - type: http
+    port: 8034
+    resources:
+      - names: [replication]
+
+  # Enable listener if this stream writer handles endpoints for the `typing` or
+  # `to_device` streams. Uses a different port to the `replication` listener to
+  # avoid exposing the `replication` listener publicly.
+  #
+  #- type: http
+  #  port: 8035
+  #  resources:
+  #    - names: [client]
+
+worker_log_config: /etc/matrix-synapse/event-persister-log.yaml
+

Some of the streams have associated endpoints which, for maximum efficiency, should be routed to the workers handling that stream. See below for the currently supported streams and the endpoints associated with them:

@@ -488,7 +511,7 @@ the stream writer for the presence stream:

^/_matrix/client/(api/v1|r0|v3|unstable)/presence/
 

Background tasks

-

There is also experimental support for moving background tasks to a separate +

There is also support for moving background tasks to a separate worker. Background tasks are run periodically or started via replication. Exactly which tasks are configured to run depends on your Synapse configuration (e.g. if stats is enabled).

@@ -499,6 +522,16 @@ the shared configuration would include:

You might also wish to investigate the update_user_directory and media_instance_running_background_jobs settings.

+

An example for a dedicated background worker instance:

+
worker_app: synapse.app.generic_worker
+worker_name: background_worker
+
+# The replication listener on the main synapse process.
+worker_replication_host: 127.0.0.1
+worker_replication_http_port: 9093
+
+worker_log_config: /etc/matrix-synapse/background-worker-log.yaml
+

synapse.app.pusher

Handles sending push notifications to sygnal and email. Doesn't handle any REST endpoints itself, but you should set start_pushers: False in the @@ -629,15 +662,15 @@ in systemd service files, but not required for synctl).

| Main | | Generic | | Generic | | Event | | Process | | Worker 1 | | Worker 2 | | Persister | +--------------+ +--------------+ +--------------+ +--------------+ - ^ ^ | ^ | | ^ | ^ ^ - | | | | | | | | | | - | | | | | HTTP | | | | | - | +----------+<--|---|---------+ | | | | - | | +-------------|-->+----------+ | - | | | | - | | | | - v v v v -==================================================================== + ^ ^ | ^ | | ^ | | ^ ^ + | | | | | | | | | | | + | | | | | HTTP | | | | | | + | +----------+<--|---|---------+<--|---|---------+ | | + | | +-------------|-->+-------------+ | + | | | | + | | | | + v v v v +====================================================================== Redis pub/sub channel -- cgit 1.5.1