2019-09-17 14:55:29 +03:00
|
|
|
# Scaling synapse via workers
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
For small instances it recommended to run Synapse in monolith mode (the
|
|
|
|
default). For larger instances where performance is a concern it can be helpful
|
|
|
|
to split out functionality into multiple separate python processes. These
|
2016-08-19 20:55:57 +03:00
|
|
|
processes are called 'workers', and are (eventually) intended to scale
|
|
|
|
horizontally independently.
|
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
Synapse's worker support is under active development and subject to change as
|
|
|
|
we attempt to rapidly scale ever larger Synapse instances. However we are
|
|
|
|
documenting it here to help admins needing a highly scalable Synapse instance
|
|
|
|
similar to the one running `matrix.org`.
|
2017-11-21 16:22:43 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
All processes continue to share the same database instance, and as such,
|
|
|
|
workers only work with PostgreSQL-based Synapse deployments. SQLite should only
|
|
|
|
be used for demo purposes and any admin considering workers should already be
|
|
|
|
running PostgreSQL.
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
## Master/worker communication
|
|
|
|
|
|
|
|
The workers communicate with the master process via a Synapse-specific protocol
|
|
|
|
called 'replication' (analogous to MySQL- or Postgres-style database
|
|
|
|
replication) which feeds a stream of relevant data from the master to the
|
|
|
|
workers so they can be kept in sync with the master process and database state.
|
|
|
|
|
|
|
|
Additionally, workers may make HTTP requests to the master, to send information
|
|
|
|
in the other direction. Typically this is used for operations which need to
|
|
|
|
wait for a reply - such as sending an event.
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
## Configuration
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
To make effective use of the workers, you will need to configure an HTTP
|
|
|
|
reverse-proxy such as nginx or haproxy, which will direct incoming requests to
|
|
|
|
the correct worker, or to the main synapse instance. Note that this includes
|
2019-09-17 14:55:29 +03:00
|
|
|
requests made to the federation port. See [reverse_proxy.md](reverse_proxy.md)
|
|
|
|
for information on setting up a reverse proxy.
|
2017-11-21 16:22:43 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
To enable workers, you need to add *two* replication listeners to the
|
|
|
|
main Synapse configuration file (`homeserver.yaml`). For example:
|
2016-08-19 21:16:55 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
```yaml
|
|
|
|
listeners:
|
|
|
|
# The TCP replication port
|
|
|
|
- port: 9092
|
|
|
|
bind_address: '127.0.0.1'
|
|
|
|
type: replication
|
|
|
|
|
|
|
|
# The HTTP replication port
|
|
|
|
- port: 9093
|
|
|
|
bind_address: '127.0.0.1'
|
|
|
|
type: http
|
|
|
|
resources:
|
|
|
|
- names: [replication]
|
|
|
|
```
|
2018-02-12 20:18:07 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
Under **no circumstances** should these replication API listeners be exposed to
|
|
|
|
the public internet; they have no authentication and are unencrypted.
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
You should then create a set of configs for the various worker processes. Each
|
|
|
|
worker configuration file inherits the configuration of the main homeserver
|
|
|
|
configuration file. You can then override configuration specific to that
|
|
|
|
worker, e.g. the HTTP listener that it provides (if any); logging
|
|
|
|
configuration; etc. You should minimise the number of overrides though to
|
|
|
|
maintain a usable config.
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2020-04-08 13:59:26 +03:00
|
|
|
In the config file for each worker, you must specify the type of worker
|
|
|
|
application (`worker_app`). The currently available worker applications are
|
2020-05-11 15:21:15 +03:00
|
|
|
listed below. You must also specify the replication endpoints that it should
|
|
|
|
talk to on the main synapse process. `worker_replication_host` should specify
|
|
|
|
the host of the main synapse, `worker_replication_port` should point to the TCP
|
2020-04-08 13:59:26 +03:00
|
|
|
replication listener port and `worker_replication_http_port` should point to
|
|
|
|
the HTTP replication port.
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
For example:
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
```yaml
|
|
|
|
worker_app: synapse.app.synchrotron
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
# The replication listener on the synapse to talk to.
|
|
|
|
worker_replication_host: 127.0.0.1
|
|
|
|
worker_replication_port: 9092
|
|
|
|
worker_replication_http_port: 9093
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
worker_listeners:
|
|
|
|
- type: http
|
|
|
|
port: 8083
|
|
|
|
resources:
|
|
|
|
- names:
|
|
|
|
- client
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
worker_log_config: /home/matrix/synapse/config/synchrotron_log_config.yaml
|
|
|
|
```
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2016-08-19 21:16:55 +03:00
|
|
|
...is a full configuration for a synchrotron worker instance, which will expose a
|
2019-09-17 14:55:29 +03:00
|
|
|
plain HTTP `/sync` endpoint on port 8083 separately from the `/sync` endpoint provided
|
2016-08-19 20:55:57 +03:00
|
|
|
by the main synapse.
|
|
|
|
|
2017-11-21 16:22:43 +03:00
|
|
|
Obviously you should configure your reverse-proxy to route the relevant
|
2019-09-17 14:55:29 +03:00
|
|
|
endpoints to the worker (`localhost:8083` in the above example).
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2020-04-08 13:59:26 +03:00
|
|
|
Finally, you need to start your worker processes. This can be done with either
|
|
|
|
`synctl` or your distribution's preferred service manager such as `systemd`. We
|
|
|
|
recommend the use of `systemd` where available: for information on setting up
|
|
|
|
`systemd` to start synapse workers, see
|
|
|
|
[systemd-with-workers](systemd-with-workers). To use `synctl`, see below.
|
|
|
|
|
2020-05-11 15:21:15 +03:00
|
|
|
### **Experimental** support for replication over redis
|
|
|
|
|
|
|
|
As of Synapse v1.13.0, it is possible to configure Synapse to send replication
|
|
|
|
via a [Redis pub/sub channel](https://redis.io/topics/pubsub). This is an
|
|
|
|
alternative to direct TCP connections to the master: rather than all the
|
|
|
|
workers connecting to the master, all the workers and the master connect to
|
|
|
|
Redis, which relays replication commands between processes. This can give a
|
|
|
|
significant cpu saving on the master and will be a prerequisite for upcoming
|
|
|
|
performance improvements.
|
|
|
|
|
|
|
|
Note that this support is currently experimental; you may experience lost
|
|
|
|
messages and similar problems! It is strongly recommended that admins setting
|
|
|
|
up workers for the first time use direct TCP replication as above.
|
|
|
|
|
|
|
|
To configure Synapse to use Redis:
|
|
|
|
|
|
|
|
1. Install Redis following the normal procedure for your distribution - for
|
|
|
|
example, on Debian, `apt install redis-server`. (It is safe to use an
|
|
|
|
existing Redis deployment if you have one: we use a pub/sub stream named
|
|
|
|
according to the `server_name` of your synapse server.)
|
|
|
|
2. Check Redis is running and accessible: you should be able to `echo PING | nc -q1
|
|
|
|
localhost 6379` and get a response of `+PONG`.
|
|
|
|
3. Install the python prerequisites. If you installed synapse into a
|
|
|
|
virtualenv, this can be done with:
|
|
|
|
```sh
|
|
|
|
pip install matrix-synapse[redis]
|
|
|
|
```
|
|
|
|
The debian packages from matrix.org already include the required
|
|
|
|
dependencies.
|
|
|
|
4. Add config to the shared configuration (`homeserver.yaml`):
|
|
|
|
```yaml
|
|
|
|
redis:
|
|
|
|
enabled: true
|
|
|
|
```
|
|
|
|
Optional parameters which can go alongside `enabled` are `host`, `port`,
|
|
|
|
`password`. Normally none of these are required.
|
|
|
|
5. Restart master and all workers.
|
|
|
|
|
|
|
|
Once redis replication is in use, `worker_replication_port` is redundant and
|
|
|
|
can be removed from the worker configuration files. Similarly, the
|
|
|
|
configuration for the `listener` for the TCP replication port can be removed
|
|
|
|
from the main configuration file. Note that the HTTP replication port is
|
|
|
|
still required.
|
|
|
|
|
2020-04-08 13:59:26 +03:00
|
|
|
### Using synctl
|
|
|
|
|
|
|
|
If you want to use `synctl` to manage your synapse processes, you will need to
|
|
|
|
create an an additional configuration file for the master synapse process. That
|
|
|
|
configuration should look like this:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
worker_app: synapse.app.homeserver
|
|
|
|
```
|
|
|
|
|
|
|
|
Additionally, each worker app must be configured with the name of a "pid file",
|
|
|
|
to which it will write its process ID when it starts. For example, for a
|
|
|
|
synchrotron, you might write:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
worker_pid_file: /home/matrix/synapse/synchrotron.pid
|
|
|
|
```
|
|
|
|
|
|
|
|
Finally, to actually run your worker-based synapse, you must pass synctl the `-a`
|
2016-08-19 20:55:57 +03:00
|
|
|
commandline option to tell it to operate on all the worker configurations found
|
2019-09-17 14:55:29 +03:00
|
|
|
in the given directory, e.g.:
|
2016-08-19 20:55:57 +03:00
|
|
|
|
|
|
|
synctl -a $CONFIG/workers start
|
|
|
|
|
|
|
|
Currently one should always restart all workers when restarting or upgrading
|
|
|
|
synapse, unless you explicitly know it's safe not to. For instance, restarting
|
2016-08-19 21:16:55 +03:00
|
|
|
synapse without restarting all the synchrotrons may result in broken typing
|
2016-08-19 20:55:57 +03:00
|
|
|
notifications.
|
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
To manipulate a specific worker, you pass the -w option to synctl:
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2016-08-19 21:16:55 +03:00
|
|
|
synctl -w $CONFIG/workers/synchrotron.yaml restart
|
2016-08-19 20:55:57 +03:00
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
## Available worker applications
|
2017-11-21 16:22:43 +03:00
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
### `synapse.app.pusher`
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
Handles sending push notifications to sygnal and email. Doesn't handle any
|
2019-09-17 14:55:29 +03:00
|
|
|
REST endpoints itself, but you should set `start_pushers: False` in the
|
2017-11-21 16:22:43 +03:00
|
|
|
shared configuration file to stop the main synapse sending these notifications.
|
|
|
|
|
|
|
|
Note this worker cannot be load-balanced: only one instance should be active.
|
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
### `synapse.app.synchrotron`
|
2017-11-21 16:22:43 +03:00
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
The synchrotron handles `sync` requests from clients. In particular, it can
|
|
|
|
handle REST endpoints matching the following regular expressions:
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
^/_matrix/client/(v2_alpha|r0)/sync$
|
|
|
|
^/_matrix/client/(api/v1|v2_alpha|r0)/events$
|
|
|
|
^/_matrix/client/(api/v1|r0)/initialSync$
|
|
|
|
^/_matrix/client/(api/v1|r0)/rooms/[^/]+/initialSync$
|
|
|
|
|
|
|
|
The above endpoints should all be routed to the synchrotron worker by the
|
|
|
|
reverse-proxy configuration.
|
|
|
|
|
|
|
|
It is possible to run multiple instances of the synchrotron to scale
|
|
|
|
horizontally. In this case the reverse-proxy should be configured to
|
|
|
|
load-balance across the instances, though it will be more efficient if all
|
|
|
|
requests from a particular user are routed to a single instance. Extracting
|
|
|
|
a userid from the access token is currently left as an exercise for the reader.
|
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
### `synapse.app.appservice`
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
Handles sending output traffic to Application Services. Doesn't handle any
|
2019-09-17 14:55:29 +03:00
|
|
|
REST endpoints itself, but you should set `notify_appservices: False` in the
|
2017-11-21 16:22:43 +03:00
|
|
|
shared configuration file to stop the main synapse sending these notifications.
|
|
|
|
|
|
|
|
Note this worker cannot be load-balanced: only one instance should be active.
|
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
### `synapse.app.federation_reader`
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
Handles a subset of federation endpoints. In particular, it can handle REST
|
2019-09-17 14:55:29 +03:00
|
|
|
endpoints matching the following regular expressions:
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
^/_matrix/federation/v1/event/
|
|
|
|
^/_matrix/federation/v1/state/
|
|
|
|
^/_matrix/federation/v1/state_ids/
|
|
|
|
^/_matrix/federation/v1/backfill/
|
|
|
|
^/_matrix/federation/v1/get_missing_events/
|
|
|
|
^/_matrix/federation/v1/publicRooms
|
2018-08-09 12:33:55 +03:00
|
|
|
^/_matrix/federation/v1/query/
|
|
|
|
^/_matrix/federation/v1/make_join/
|
|
|
|
^/_matrix/federation/v1/make_leave/
|
|
|
|
^/_matrix/federation/v1/send_join/
|
2020-01-13 18:32:02 +03:00
|
|
|
^/_matrix/federation/v2/send_join/
|
2018-08-09 12:33:55 +03:00
|
|
|
^/_matrix/federation/v1/send_leave/
|
2020-01-13 18:32:02 +03:00
|
|
|
^/_matrix/federation/v2/send_leave/
|
2018-08-09 12:33:55 +03:00
|
|
|
^/_matrix/federation/v1/invite/
|
2020-01-13 18:32:02 +03:00
|
|
|
^/_matrix/federation/v2/invite/
|
2018-08-09 12:33:55 +03:00
|
|
|
^/_matrix/federation/v1/query_auth/
|
|
|
|
^/_matrix/federation/v1/event_auth/
|
|
|
|
^/_matrix/federation/v1/exchange_third_party_invite/
|
2020-02-07 18:45:39 +03:00
|
|
|
^/_matrix/federation/v1/user/devices/
|
2018-08-09 12:33:55 +03:00
|
|
|
^/_matrix/federation/v1/send/
|
2020-02-07 14:14:19 +03:00
|
|
|
^/_matrix/federation/v1/get_groups_publicised$
|
2019-02-27 16:43:53 +03:00
|
|
|
^/_matrix/key/v2/query
|
2017-11-21 16:22:43 +03:00
|
|
|
|
2020-02-07 14:14:19 +03:00
|
|
|
Additionally, the following REST endpoints can be handled for GET requests:
|
|
|
|
|
|
|
|
^/_matrix/federation/v1/groups/
|
|
|
|
|
2017-11-21 16:22:43 +03:00
|
|
|
The above endpoints should all be routed to the federation_reader worker by the
|
|
|
|
reverse-proxy configuration.
|
|
|
|
|
2018-08-09 12:33:55 +03:00
|
|
|
The `^/_matrix/federation/v1/send/` endpoint must only be handled by a single
|
|
|
|
instance.
|
|
|
|
|
2020-01-27 11:20:48 +03:00
|
|
|
Note that `federation` must be added to the listener resources in the worker config:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
worker_app: synapse.app.federation_reader
|
|
|
|
...
|
|
|
|
worker_listeners:
|
|
|
|
- type: http
|
|
|
|
port: <port>
|
|
|
|
resources:
|
|
|
|
- names:
|
|
|
|
- federation
|
|
|
|
```
|
2020-01-24 12:01:57 +03:00
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
### `synapse.app.federation_sender`
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
Handles sending federation traffic to other servers. Doesn't handle any
|
2019-09-17 14:55:29 +03:00
|
|
|
REST endpoints itself, but you should set `send_federation: False` in the
|
2017-11-21 16:22:43 +03:00
|
|
|
shared configuration file to stop the main synapse sending this traffic.
|
|
|
|
|
|
|
|
Note this worker cannot be load-balanced: only one instance should be active.
|
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
### `synapse.app.media_repository`
|
2017-11-21 16:22:43 +03:00
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
Handles the media repository. It can handle all endpoints starting with:
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
/_matrix/media/
|
|
|
|
|
2019-12-11 19:23:38 +03:00
|
|
|
... and the following regular expressions matching media-specific administration APIs:
|
2019-08-13 14:49:28 +03:00
|
|
|
|
|
|
|
^/_synapse/admin/v1/purge_media_cache$
|
2020-01-13 21:10:43 +03:00
|
|
|
^/_synapse/admin/v1/room/.*/media.*$
|
|
|
|
^/_synapse/admin/v1/user/.*/media.*$
|
|
|
|
^/_synapse/admin/v1/media/.*$
|
2019-08-13 14:49:28 +03:00
|
|
|
^/_synapse/admin/v1/quarantine_media/.*$
|
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
You should also set `enable_media_repo: False` in the shared configuration
|
2017-11-21 16:29:39 +03:00
|
|
|
file to stop the main synapse running background jobs related to managing the
|
|
|
|
media repository.
|
|
|
|
|
2019-12-11 19:23:38 +03:00
|
|
|
In the `media_repository` worker configuration file, configure the http listener to
|
|
|
|
expose the `media` resource. For example:
|
|
|
|
|
|
|
|
```yaml
|
|
|
|
worker_listeners:
|
|
|
|
- type: http
|
|
|
|
port: 8085
|
|
|
|
resources:
|
|
|
|
- names:
|
|
|
|
- media
|
|
|
|
```
|
|
|
|
|
2017-11-21 16:22:43 +03:00
|
|
|
Note this worker cannot be load-balanced: only one instance should be active.
|
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
### `synapse.app.client_reader`
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
Handles client API endpoints. It can handle REST endpoints matching the
|
2019-09-17 14:55:29 +03:00
|
|
|
following regular expressions:
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/publicRooms$
|
2018-07-23 15:20:43 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/joined_members$
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/context/.*$
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/members$
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/state$
|
2019-02-18 20:21:51 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/login$
|
2019-02-27 17:26:08 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/account/3pid$
|
2019-03-04 21:09:06 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/keys/query$
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/keys/changes$
|
2019-04-15 19:13:16 +03:00
|
|
|
^/_matrix/client/versions$
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/voip/turnServer$
|
2020-02-07 14:14:19 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/joined_groups$
|
2020-02-18 18:27:45 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/publicised_groups$
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/publicised_groups/
|
2019-04-15 20:40:15 +03:00
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
Additionally, the following REST endpoints can be handled for GET requests:
|
2019-04-15 20:40:15 +03:00
|
|
|
|
2019-04-15 19:13:16 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/pushrules/.*$
|
2020-02-07 14:14:19 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/groups/.*$
|
2020-04-21 12:46:30 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/user/[^/]*/account_data/
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/user/[^/]*/rooms/[^/]*/account_data/
|
2017-11-21 16:22:43 +03:00
|
|
|
|
2019-02-18 18:25:44 +03:00
|
|
|
Additionally, the following REST endpoints can be handled, but all requests must
|
2019-09-17 14:55:29 +03:00
|
|
|
be routed to the same instance:
|
2019-02-18 18:25:44 +03:00
|
|
|
|
2019-02-18 20:21:51 +03:00
|
|
|
^/_matrix/client/(r0|unstable)/register$
|
2020-03-09 14:19:24 +03:00
|
|
|
^/_matrix/client/(r0|unstable)/auth/.*/fallback/web$
|
2019-02-18 18:25:44 +03:00
|
|
|
|
2019-06-21 12:43:12 +03:00
|
|
|
Pagination requests can also be handled, but all requests with the same path
|
|
|
|
room must be routed to the same instance. Additionally, care must be taken to
|
|
|
|
ensure that the purge history admin API is not used while pagination requests
|
2019-09-17 14:55:29 +03:00
|
|
|
for the room are in flight:
|
2019-06-21 12:43:12 +03:00
|
|
|
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/messages$
|
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
### `synapse.app.user_dir`
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
Handles searches in the user directory. It can handle REST endpoints matching
|
2019-09-17 14:55:29 +03:00
|
|
|
the following regular expressions:
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/user_directory/search$
|
|
|
|
|
2020-02-18 18:27:45 +03:00
|
|
|
When using this worker you must also set `update_user_directory: False` in the
|
|
|
|
shared configuration file to stop the main synapse running background
|
2020-01-24 12:01:57 +03:00
|
|
|
jobs related to updating the user directory.
|
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
### `synapse.app.frontend_proxy`
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
Proxies some frequently-requested client endpoints to add caching and remove
|
|
|
|
load from the main synapse. It can handle REST endpoints matching the following
|
2019-09-17 14:55:29 +03:00
|
|
|
regular expressions:
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/keys/upload
|
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
If `use_presence` is False in the homeserver config, it can also handle REST
|
|
|
|
endpoints matching the following regular expressions:
|
2018-08-17 18:08:45 +03:00
|
|
|
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/presence/[^/]+/status
|
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
This "stub" presence handler will pass through `GET` request but make the
|
|
|
|
`PUT` effectively a no-op.
|
2018-08-17 18:08:45 +03:00
|
|
|
|
2017-11-21 16:22:43 +03:00
|
|
|
It will proxy any requests it cannot handle to the main synapse instance. It
|
|
|
|
must therefore be configured with the location of the main instance, via
|
2019-09-17 14:55:29 +03:00
|
|
|
the `worker_main_http_uri` setting in the `frontend_proxy` worker configuration
|
|
|
|
file. For example:
|
2017-11-21 16:22:43 +03:00
|
|
|
|
|
|
|
worker_main_http_uri: http://127.0.0.1:8008
|
2018-02-06 20:23:13 +03:00
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
### `synapse.app.event_creator`
|
2018-02-06 20:23:13 +03:00
|
|
|
|
2019-09-17 14:55:29 +03:00
|
|
|
Handles some event creation. It can handle REST endpoints matching:
|
2018-02-06 20:23:13 +03:00
|
|
|
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/send
|
2020-01-13 18:32:02 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/state/
|
2018-04-04 17:46:17 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$
|
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/join/
|
2018-08-07 12:51:35 +03:00
|
|
|
^/_matrix/client/(api/v1|r0|unstable)/profile/
|
2018-02-06 20:23:13 +03:00
|
|
|
|
|
|
|
It will create events locally and then send them on to the main synapse
|
|
|
|
instance to be persisted and handled.
|