forked from Fediversity/Fediversity
Restructuring.
This commit is contained in:
parent
b8b63484cf
commit
cca8bcaa2b
|
@ -11,6 +11,17 @@ the load. So you want to create several threads for different types of work.
|
|||
See this [Matrix blog](https://matrix.org/blog/2020/11/03/how-we-fixed-synapse-s-scalability/)
|
||||
for some background information.
|
||||
|
||||
The traditional Synapse setup is one monolithic piece of software that does
|
||||
everything. Joining a very busy room makes a bottleneck, as the server will
|
||||
spend all its cycles on synchronizing that room.
|
||||
|
||||
You can split the server into workers, that are basically Synapse servers
|
||||
themselves. Redirect specific tasks to them and you have several different
|
||||
servers doing all kinds of tasks at the same time. A busy room will no longer
|
||||
freeze the rest.
|
||||
|
||||
Workers communicate with each other via socket files and Redis.
|
||||
|
||||
|
||||
# Redis
|
||||
|
||||
|
@ -45,12 +56,19 @@ longer active, and if the socketfile `/run/redis/redis-server.sock` exists.
|
|||
|
||||
# Synapse
|
||||
|
||||
First, create the directory where all the socket files for workers will come,
|
||||
Workers communicate with each other over sockets, that are all placed in one
|
||||
directory. To make sure only the users that need access will have it, we
|
||||
create a new group and add the users to it.
|
||||
|
||||
Then, create the directory where all the socket files for workers will come,
|
||||
and give it the correct user, group and permission:
|
||||
|
||||
```
|
||||
groupadd --system clubmatrix
|
||||
useradd matrix-synapse clubmatrix
|
||||
useradd www-data clubmatrix
|
||||
mkdir /run/matrix-synapse
|
||||
dpkg-statoverride --add --update matrix-synapse matrix-synapse 0770 /run/matrix-synapse
|
||||
dpkg-statoverride --add --update matrix-synapse clubmatrix 2770 /run/matrix-synapse
|
||||
```
|
||||
|
||||
Add a replication listener:
|
||||
|
@ -89,29 +107,9 @@ synapse.replication.tcp.redis - 141 - INFO - subscribe-replication-0 - Successfu
|
|||
synapse.replication.tcp.redis - 146 - INFO - subscribe-replication-0 - REPLICATE successfully sent
|
||||
```
|
||||
|
||||
|
||||
# Workers
|
||||
|
||||
Workers are Synapse instances that perform a single job (or a set of jobs).
|
||||
Their configuration goes into `/etc/matrix-synapse/workers`, which we have to
|
||||
create first.
|
||||
|
||||
Create a worker for
|
||||
|
||||
# Preparing for sockets
|
||||
|
||||
Because we use sockets for speed, we should make sure only those programs that
|
||||
need access to those sockets get it.
|
||||
|
||||
Create a new group and add the users that need access to it:
|
||||
|
||||
```
|
||||
addgroup --system clubmatrix
|
||||
addgroup matrix-synapse clubmatrix
|
||||
addgroup www-data clubmatrix
|
||||
```
|
||||
|
||||
Create one systemd service file for all workers:
|
||||
Every worker has its own configuration file, we'll put those under
|
||||
`/etc/matrix-synapse/workers`. Create it, and then one systemd service file for
|
||||
all workers:
|
||||
|
||||
```
|
||||
[Unit]
|
||||
|
|
Loading…
Reference in a new issue