Skip to content

Repository files navigation

Matrix-Stack

Helm repository

helm repo add code-tool https://code-tool.github.io/matrix-stack/

Charts overview

  1. synapse - for setting up matrix workers, MAS, sliding-sync, admin component
  2. ldap - for setting up LDAP proxy
  3. sentry-webhook - for webhook from sentry to matrix chat
  4. webhook - for webhook from slack-compatible clients to matrix chat
  5. matrix-alertmanager-receiver - for webhook from Prometheus Alertmanager to matrix chat
  6. livekit-jwt - for LiveKit management service
  7. compress-state - experimental tools that attempt to reduce the number of rows in the state_groups_state table inside of a Synapse Postgresql database

Visualisation

Matrix home servers setup overview

Synapse worker architecture

The core of synapse monolith distribution is complex regexp routing to particular workers.

Worker types

synapse.app.generic_worker

Most common worker type: can read data, respond to HTTP API, client and federation requests. Has no streams and cannot write any stream by itself.

A generic worker can be:

  • reader - client_reader, federation_reader, sync, room
  • stream writer - if configured in the stream_writers section
  • both simultaneously

generic_worker is not an architecture type - it is a behavior type determined by config.

Stream writer

Not a separate app type - this is a role for a generic worker when it is listed in stream_writers. The stream writer owns a Redis stream exclusively; other workers write to that stream by sending HTTP requests to it.

Requirements:

  • must be in instance_map
  • must have a replication listener (port 9093)

Singleton streams (one writer only): typing, to_device, account_data, presence, push_rules

Scalable streams (round-robin across multiple writers): receipts, device_lists, thread_subscriptions, quarantined_media, events

synapse.app.media_repository

The only distinct worker app type, different from generic_worker:

  • uses media-specific headers
  • responds to /_matrix/media/, /_matrix/client/v1/media/, /_matrix/federation/v1/media/
  • can have a background job: media_instance_running_background_jobs
  • cannot be a stream writer
  • cannot respond to any client/federation endpoints

Background jobs

Generic workers with no HTTP endpoints:

  • background - singleton; stats, media cleanup, user directory updates
  • pusher - pusher_instances: [pusher1, pusher2]; sends push notifications
  • federation_sender - federation_sender_instances: [sender1, sender2]; outbound federation only

Worker reference table

workertypescalablepossible lb algohttp
typingstream writerno-yes
to_devicestream writerno-yes
account_datastream writerno-yes
presencestream writerno-yes
push_rulesstream writerno-yes
receiptsstream writeryesround-robinyes
device_listsstream writeryesround-robinyes
thread_subscriptionsstream writeryesround-robinyes
quarantined_media_changesstream writeryesround-robin (?)yes
events (persister)stream writeryesshard by room_idyes
media_repositoryappyesleast_connyes
media_instance_running_background_jobsappno-no
room_workergenericyeshash by room_idyes
sync_workergenericyeshash by user_idyes
federation_readergenericyeshash by source ipyes
client_readergenericyesleast_connyes
user_dirgenericno-yes
background_workergenericno-no
pushergenericyesshard by userno
federation_sendergenericyesshard by destinationno

About

K8s charts for the matrix homeserver

Resources

Stars

4 stars

Watchers

4 watching

Forks

Releases

Packages

Used by

Contributors

Languages