This page (revision-28) was last changed on 04-Apr-2022 23:13 by Tester

This page was created on 07-Aug-2019 19:32 by Johannes Brakensiek

Only authorized users are allowed to rename pages.

Only authorized users are allowed to delete pages.

Page revision history

Version Date Modified Size Author Changes ... Change note
28 04-Apr-2022 23:13 10 KB Tester to previous
27 27-Feb-2021 16:26 10 KB Christoph S. to previous | to last
26 14-Nov-2020 17:58 10 KB Christoph S. to previous | to last
25 21-Sep-2020 23:01 10 KB Christoph S. to previous | to last
24 21-Sep-2020 21:28 10 KB Christoph S. to previous | to last
23 21-Sep-2020 21:27 10 KB Christoph S. to previous | to last
22 21-Sep-2020 21:15 9 KB Christoph S. to previous | to last
21 21-Sep-2020 21:12 9 KB Christoph S. to previous | to last

Page References

Incoming links Outgoing links

Version management

Difference between version and

At line 178 added 105 lines
!!Worker-Setup
Da Synapse als Python-Programm wegen des Python Global Interpreter Locks (GIL) auf eine CPU beschränkt ist, empfiehlt es sich, für größere Installationen ein Worker-Setup einzurichten. Dies ist grundsätzlich unter [https://github.com/matrix-org/synapse/blob/develop/docs/workers.md] beschrieben. Als ersten Schritt empfiehlt es sich, die Federation-Teile auszulagern. Dazu ist der federation_sender-Worker und ein generic_worker für die Federation-Requests (/_matrix/federation/*) notwendig.
Zur Kommunikation zwischen Hauptprozess und Worker-Prozessen wird Redis mit pub/sub channels verwendet.
Die Architektur sieht dann wie folgt aus:
Main<->Worker-Kommunikation im Hauptprozess ermöglichen:
{{{
listeners:
- port: 32993
bind_address: '127.0.0.1'
type: http
resources:
- names: [replication]
# redis pub/sub main -> worker
redis:
enabled: true
port: 32992
## Worker ##
worker_app: synapse.app.homeserver
daemonize: true
# disable federation sending here, use worker for it
send_federation: false
}}}
generic_worker für die Federation-Requests, der auf Port 32902 lauscht:
{{{
worker_app: synapse.app.generic_worker
worker_name: federation_reader
worker_replication_host: 127.0.0.1
worker_replication_http_port: 32993
worker_listeners:
- type: http
port: 32902
bind_address: '127.0.0.1'
resources:
- names:
- client
- federation
- type: metrics
port: 32981
bind_address: '127.0.0.1'
}}}
Die notwendigen Einstellungen im Apache-Reverse-Proxy dazu sind:
{{{
# Federation Reader
ProxyPass "/_matrix/federation/v1/send/" "http://127.0.0.1:32902/_matrix/federation/v1/send/" nocanon
ProxyPass "/_matrix/federation/v1/event/" "http://127.0.0.1:32902/_matrix/federation/v1/event/" nocanon
ProxyPass "/_matrix/federation/v1/state/" "http://127.0.0.1:32902/_matrix/federation/v1/state/" nocanon
ProxyPass "/_matrix/federation/v1/state_ids/" "http://127.0.0.1:32902/_matrix/federation/v1/state_ids/" nocanon
ProxyPass "/_matrix/federation/v1/backfill/" "http://127.0.0.1:32902/_matrix/federation/v1/backfill/" nocanon
ProxyPass "/_matrix/federation/v1/get_missing_events/" "http://127.0.0.1:32902/_matrix/federation/v1/get_missing_events/" nocanon
ProxyPass "/_matrix/federation/v1/publicRooms" "http://127.0.0.1:32902/_matrix/federation/v1/publicRooms" nocanon
ProxyPass "/_matrix/federation/v1/query/" "http://127.0.0.1:32902/_matrix/federation/v1/query/" nocanon
ProxyPass "/_matrix/federation/v1/make_join/" "http://127.0.0.1:32902/_matrix/federation/v1/make_join/" nocanon
ProxyPass "/_matrix/federation/v1/make_leave/" "http://127.0.0.1:32902/_matrix/federation/v1/make_leave/" nocanon
ProxyPass "/_matrix/federation/v1/send_join/" "http://127.0.0.1:32902/_matrix/federation/v1/send_join/" nocanon
ProxyPass "/_matrix/federation/v2/send_join/" "http://127.0.0.1:32902/_matrix/federation/v2/send_join/" nocanon
ProxyPass "/_matrix/federation/v1/send_leave/" "http://127.0.0.1:32902/_matrix/federation/v1/send_leave/" nocanon
ProxyPass "/_matrix/federation/v2/send_leave/" "http://127.0.0.1:32902/_matrix/federation/v2/send_leave/" nocanon
ProxyPass "/_matrix/federation/v1/invite/" "http://127.0.0.1:32902/_matrix/federation/v1/invite/" nocanon
ProxyPass "/_matrix/federation/v2/invite/" "http://127.0.0.1:32902/_matrix/federation/v2/invite/" nocanon
ProxyPass "/_matrix/federation/v1/query_auth/" "http://127.0.0.1:32902/_matrix/federation/v1/query_auth/" nocanon
ProxyPass "/_matrix/federation/v1/event_auth/" "http://127.0.0.1:32902/_matrix/federation/v1/event_auth/" nocanon
ProxyPass "/_matrix/federation/v1/exchange_third_party_invite/" "http://127.0.0.1:32902/_matrix/federation/v1/exchange_third_party_invite/" nocanon
ProxyPass "/_matrix/federation/v1/user/devices/" "http://127.0.0.1:32902/_matrix/federation/v1/user/devices/" nocanon
ProxyPass "/_matrix/federation/v1/get_groups_publicised" "http://127.0.0.1:32902/_matrix/federation/v1/get_groups_publicised" nocanon
ProxyPass "/_matrix/key/v2/query" "http://127.0.0.1:32902/_matrix/key/v2/query" nocanon
}}}
Der federation_sender schickt nur Requests raus, daher benötigt nur seine eigene Worker-Konfiguration:
{{{
worker_app: synapse.app.federation_sender
# The replication listener on the synapse to talk to.
worker_replication_host: 127.0.0.1
worker_replication_http_port: 32993
worker_listeners:
- type: metrics
port: 32980
bind_address: '127.0.0.1'
}}}
Die Worker entweder per init-System der Wahl starten, für systemd sind Konfigurationen hier verfügbar: [https://github.com/matrix-org/synapse/tree/develop/docs/systemd-with-workers]
!!Monitoring
Einen Überblick über größere Installationen und Details, wofür CPU-Zeit verbraucht wird, ist mit dem Prometheus/Grafana-basierten Monitoring möglich:
[https://github.com/matrix-org/synapse/tree/develop/contrib/grafana]