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

Add documentation for missing worker types. #11599

Merged
merged 22 commits into from
Feb 23, 2022
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/11599.doc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Document support for the `to_device`, `account_data`, `receipts`, and `presence` stream writers for workers.
48 changes: 41 additions & 7 deletions docs/workers.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,11 @@ recommend the use of `systemd` where available: for information on setting up

### `synapse.app.generic_worker`

This worker can handle API requests matching the following regular
expressions:
This worker can handle API requests matching the following regular expressions.

Note that stream writers should have their endpoints routed directly to them for
efficiency. If this is not done, the requests will be proxied to the proper
worker.
clokep marked this conversation as resolved.
Show resolved Hide resolved

# Sync requests
^/_matrix/client/(v2_alpha|r0|v3)/sync$
Expand Down Expand Up @@ -238,19 +241,40 @@ expressions:
^/_matrix/client/(api/v1|r0|v3|unstable)/joined_rooms$
^/_matrix/client/(api/v1|r0|v3|unstable)/search$

# Encryption requests
^/_matrix/client/(api/v1|r0|v3|unstable)/keys/claim
^/_matrix/client/(api/v1|r0|v3|unstable)/room_keys

# Registration/login requests
^/_matrix/client/(api/v1|r0|v3|unstable)/login$
^/_matrix/client/(r0|v3|unstable)/register$
^/_matrix/client/unstable/org.matrix.msc3231/register/org.matrix.msc3231.login.registration_token/validity$

# Event sending requests
# Event sending requests (for the event stream writer)
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/redact
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/send
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/state/
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/(join|invite|leave|ban|unban|kick)$
^/_matrix/client/(api/v1|r0|v3|unstable)/join/
^/_matrix/client/(api/v1|r0|v3|unstable)/profile/

# Typing requests (for the typing stream writer)
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/typing
clokep marked this conversation as resolved.
Show resolved Hide resolved

# Device requests (for the to_device stream writer)
^/_matrix/client/(api/v1|r0|v3|unstable)/sendToDevice/

# Account data requests (for the account_data stream writer)
^/_matrix/client/(api/v1|r0|v3|unstable)/.*/tags
^/_matrix/client/(api/v1|r0|v3|unstable)/.*/account_data

# Receipts requests (for the receipts stream writer)
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/receipt
^/_matrix/client/(api/v1|r0|v3|unstable)/rooms/.*/read_markers

# Presence requests (for the presence stream writer)
^/_matrix/client/(api/v1|r0|v3|unstable)/presence/.*/status$
clokep marked this conversation as resolved.
Show resolved Hide resolved

erikjohnston marked this conversation as resolved.
Show resolved Hide resolved

Additionally, the following REST endpoints can be handled for GET requests:

Expand Down Expand Up @@ -330,12 +354,19 @@ 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.)

Currently supported streams are `events` and `typing`.
Currently supported streams are:

* `events`
* `typing`
* `to_device`
* `account_data`
* `receipts`
* `presence`

To enable this, the worker must have a HTTP replication listener configured,
have a `worker_name` and be listed in the `instance_map` config. For example to
move event persistence off to a dedicated worker, the shared configuration would
include:
have a `worker_name` and be listed in the `instance_map` config. The same worker
can handle multiple streams. For example, to move event persistence off to a
dedicated worker, the shared configuration would include:

```yaml
instance_map:
Expand All @@ -359,6 +390,9 @@ stream_writers:
- event_persister2
```

Each of the streams have associated endpoints which should be routed to the worker
see the end regular expression map above to properly route requests.

#### Background tasks

There is also *experimental* support for moving background tasks to a separate
Expand Down