The Synapse workers are a way to split the Synapse process into pieces and
possibly distribute them over multiple systems to balance the load between
these nodes. But even on a sole system, workers give an improvement in
response time and user experience. To ease the use of this workers it
would be helpful to include the config files in the Debian package.
To use workers you have to use a reverse proxy like Nginx or Apache to
send some of the requests to other processes than the main process. The
start of the worker processes could easily be done by Systemd.
To reroute the requests, there are rules for Nginx in
/etc/matrix-synapse/worker/*.nginx. For each worker you can reference these
rules in the *location* block:
location /_matrix/ {
proxy_pass http://[::1]:8008;
proxy_set_header X-Forwarded-For $remote_addr;
include /etc/matrix-synapse/worker/client_reader.nginx;
include /etc/matrix-synapse/worker/event_creator.nginx;
…
}
In homeserver.yaml, you have to add these entries
# 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
and some more for some of the workers; look at their config file in
/etc/matrix-synapse/worker. After this, restart the Synapse process.
Then go and enable the worker services you want to use (you don't have to
use all)
systemctl enable --now matrix-synapse@client_reader.service
matrix-synapse@event_creator.service
matrix-synapse@federation_reader.service
matrix-synapse@media_repository.service
matrix-synapse@synchrotron.service
In the end, it's pretty easy to use worker processes and having theses
config files in the Debian package would support the usage of them.