From 94ba0c55880f7bdefa1e9c264f52e70b54395003 Mon Sep 17 00:00:00 2001 From: squahtx Date: Fri, 30 Sep 2022 12:42:12 +0000 Subject: deploy: 4490697b98716452cf9bac935918418974c5ea3e --- develop/workers.html | 41 +++++++++++++++++++++++++++-------------- 1 file changed, 27 insertions(+), 14 deletions(-) (limited to 'develop/workers.html') diff --git a/develop/workers.html b/develop/workers.html index 21ddd59be1..e9ce04877e 100644 --- a/develop/workers.html +++ b/develop/workers.html @@ -245,7 +245,8 @@ public internet; replication traffic is:

  • The HTTP replication endpoint that it should talk to on the main synapse process (worker_replication_host and worker_replication_http_port)
  • If handling HTTP requests, a worker_listeners option with an http -listener, in the same way as the listeners option in the shared config.
  • +listener, in the same way as the listeners +option in the shared config.
  • If handling the ^/_matrix/client/v3/keys/upload endpoint, the HTTP URI for the main process (worker_main_http_uri).
  • @@ -400,8 +401,9 @@ using):

    For multiple workers not handling the SSO endpoints properly, see #7530 and #9427.

    -

    Note that a HTTP listener with client and federation resources must be -configured in the worker_listeners option in the worker config.

    +

    Note that a HTTP listener +with client and federation resources must be configured in the worker_listeners +option in the worker config.

    Load balancing

    It is possible to run multiple instances of this worker app, with incoming requests being load-balanced between them by the reverse-proxy. However, different endpoints @@ -431,7 +433,8 @@ effects of bursts of events from that bridge on events sent by normal users.

    Stream writers

    Additionally, the writing of specific streams (such as events) can be moved off of the main process to a particular worker.

    -

    To enable this, the worker must have a HTTP replication listener configured, +

    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 have a single writer.

    @@ -514,7 +517,7 @@ the stream writer for the presence stream:

    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).

    +stats is enabled). This worker doesn't handle any REST endpoints itself.

    To enable this, the worker must have a worker_name and can be configured to run background tasks. For example, to move background tasks to a dedicated worker, the shared configuration would include:

    @@ -548,8 +551,9 @@ it to the chosen user directory worker.

    This style of configuration supersedes the legacy synapse.app.user_dir worker application type.

    Notifying Application Services

    -

    You can designate one generic worker to send output traffic to Application Services.

    -

    Specify its name in the shared configuration as follows:

    +

    You can designate one generic worker to send output traffic to Application Services. +Doesn't handle any REST endpoints itself, but you should specify its name in the +shared configuration as follows:

    notify_appservices_from_worker: worker_name
     

    This work cannot be load-balanced; please ensure the main process is restarted @@ -601,14 +605,23 @@ For example:

    file to stop the main synapse running background jobs related to managing the media repository. Note that doing so will prevent the main process from being able to handle the above endpoints.

    -

    In the media_repository worker configuration file, configure the http listener to +

    In the media_repository worker configuration file, configure the +HTTP listener to expose the media resource. For example:

    -
    worker_listeners:
    - - type: http
    -   port: 8085
    -   resources:
    -     - names:
    -       - media
    +
    worker_app: synapse.app.media_repository
    +worker_name: media_worker
    +
    +# 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: 8085
    +    resources:
    +      - names: [media]
    +
    +worker_log_config: /etc/matrix-synapse/media-worker-log.yaml
     

    Note that if running multiple media repositories they must be on the same server and you must configure a single instance to run the background tasks, e.g.:

    -- cgit 1.4.1