From 547bf0988ef81edb25fd0783b8d635108f614626 Mon Sep 17 00:00:00 2001
From: anoadragon453 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.
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:
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 thepresence
stream:
^/_matrix/client/(api/v1|r0|v3|unstable)/presence/
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).