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

Docker and scalability #13555

Open
Open
@max06

Description

@max06

Description:

I'm currently trying to utilize scaled workers to distribute the workload, mainly for federation, to multiple processes. It turned out, this is more complicated than it needs to be.

See this example docker-compose file:

  synapse-worker-federation-sender:
    <<: *synapse
    command: >
      run 
      -m synapse.app.federation_sender
      --config-path=/data/homeserver.yaml
      --config-path=/data/federation_sender.yaml
    labels: [... stuff for reverse proxy ...]
    deploy:
      mode: replicated
      replicas: 4

As soon as I start running more than one instance, several issues arise:

  • a worker_name needs to be specified for each worker
    • this needs to be done in the workers config file
    • the shared configuration needs to be updated as well
    • the main process needs to be restarted as well

Usually it's enough to have one side knowing the details for connecting to its peers. It's either the main process knowing about all worker instances, or all worker instance knowing who's the central controlling unit (preferred). Here we have both sides knowing about both ends, redundant information.

Suggestions:

  • Make things like worker_name configurable via env vars - to avoid having different, but similar configuration files for the same purpose
  • Allow using dynamically generated worker names if nothing is specified - the hostname would be a great start in case of docker containers
  • Make workers register themselfes via redis pubsub at runtime.

I'll have to scale up my synapse configuration by a lot in the foreseeable future and I'd really prefer to not define every single worker instance manually. Having at least one of the above mentioned options would make it easier.

I'd also be very happy if I've simply overseen the obvious!

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-ConfigConfiguration, or the documentation thereofA-WorkersProblems related to running Synapse in Worker Mode (or replication)T-EnhancementNew features, changes in functionality, improvements in performance, or user-facing enhancements.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions