Redis for Synapse worker replication

Redis is the message bus that lets the Synapse main process and its workers stay in step. This page explains what it does, how to size and authenticate it, and how to keep it off public networks.

On this page

Why Synapse workers need Redis for replication

Redis relays replication between the Synapse main process and its workers, and a worker deployment cannot run without it. Once a homeserver that has outgrown a single process is split into workers, every process must exchange replication events with the main process through Redis, so Synapse Redis replication is the channel that keeps room state, events, typing notices, presence and other stream data consistent across the cluster. The Synapse workers documentation describes Redis as the relay between the main process and all workers, and the generic workers that handle client, federation and event traffic depend on that relay to see what the rest of the deployment has written.

Redis therefore belongs in the architecture plan from the start, not in a later tuning pass. A team that is moving to workers because the main process cannot keep up will add Redis, a second service with its own failure modes, alongside the PostgreSQL changes and the routing rules the move requires. Redis is not an optional cache that can be dropped when it misbehaves. If it becomes unavailable, workers lose their view of the stream, so the team needs to decide who owns the instance, where it runs, how it is monitored and how it fails over. Confirm with your Synapse version which settings your worker layout requires, and treat the Redis instance as a production dependency with its own on-call and capacity review.

Before you commit to the worker move, check the sibling topic on when to move Synapse from a single process to workers, which covers the signs that a monolithic process has run out of room. Then decide where Redis will run, whether on hosts you control, in a container platform or with a managed service, and confirm that every process in the planned layout can reach it on the network. Choosing that placement early shapes the authentication, sizing and network-isolation decisions that follow in the rest of this topic.

Redis configuration options and when each fits

This table compares the main Synapse redis settings against three deployment shapes: a single-host lab, a private-network production cluster, and a managed Redis service. Read each row as a setting, then check the matching column for the shape you are building. The main takeaway is that the defaults only suit a local lab, and the authentication and transport choices should be confirmed against the Synapse release you run.

SettingSingle-host labPrivate-network productionManaged Redis service
enabledSet to true only when workers run, since the default is falseSet to true on the main process and every worker that replicatesSet to true and point host and port at the service endpoint
host and portDefaults to localhost on port 6379, which is fine when Redis shares the hostUse a private address on a dedicated replication network, never a public interfaceUse the provider's private endpoint and confirm the port it assigns
usernameUsually unnecessary if Redis runs without ACL usersUse a dedicated ACL user with only the commands Synapse needs, if your Redis version supports itOften required by the provider; confirm the Synapse release supports the username option (added in 1.162.0)
passwordAcceptable for a throwaway instance, but avoid committing it to config filesPrefer password_path so the secret is read from a file with restricted permissionsUsually required; supply it through password_path where the release supports it (added in 1.116.0)
password_pathOptional; useful to practice the file-based secret patternRecommended, with the file owned by the Synapse user and readable only by itRecommended, paired with the provider's rotation process; confirm the file is re-read after rotation
TLS optionsNot needed on localhostConfirm in the configuration manual for your release whether TLS settings exist; if not, rely on a private network or a TLS tunnelConfirm whether the provider requires TLS and which Synapse option, if any, enables it for your release
worker_replication_secretSet it even in a lab so the habit carries forwardRequired on the main process and all workers, separate from the Redis passwordRequired in the same way, since it protects worker requests and is independent of Redis access

Sizing Redis for the replication workload

Redis in a Synapse worker deployment carries replication traffic between the main process and every worker, so its load grows with the process layout and the activity on the server. The cards below cover the factors that move that load, how to measure them, and how to size the instance and its failover design from observed data rather than assumed figures.

Number of worker processes

Every worker holds a replication connection through Redis, so the count of processes is the first driver of connection and message volume. Adding workers for sync, federation, media or event persistence raises the load even when user activity stays flat. List each planned worker type and instance, then count the connections that each one opens before choosing an instance size.

Replication traffic volume

Redis relays stream position updates and cache invalidation messages between processes, so traffic follows how often state changes on the server. Measure message rates and client connection counts on the Redis side during normal hours and during peaks, and ask the Synapse maintainers which replication streams generate the most traffic for your configuration.

Room and event activity

Busy rooms, large federated rooms and heavy message bursts produce more stream updates for workers to consume. A deployment with many quiet accounts can load Redis very differently from one with a few active, highly joined rooms. Correlate Redis operations per second with the Synapse event rate and with your busiest rooms so that you can see which activity causes the peaks.

Memory headroom

Redis keeps its working data in memory, and the amount needed depends on connection state, queued messages and any other keys stored on the same instance. Track used memory, memory fragmentation and eviction or out-of-memory events over time, and keep headroom for growth and for the memory spike that follows a restart or a failover. Confirm the eviction policy with your Redis edition before relying on it.

Failover and instance size

A single Redis instance is a single point of failure for every worker. If you add Sentinel for automatic failover, the replica must hold the same working set, and the sizing decision must account for a replica that takes over under load. Base the instance size on observed peaks plus failover headroom, and test promotion with the workers running so you learn how long reconnection takes.

Sentinel docs

Sizing inputs to request

Ask the Synapse maintainers and your own benchmark team for the expected replication load for your worker layout, and treat any answer without measured inputs as a starting point only. Give them your user count, worker list, room profile and monitoring data. Ask the vendor or partner to state which measurements the sizing assumes, so that you can rerun the estimate when the layout changes.

Synapse workers docs

Choosing Redis authentication for Synapse

A single-host test environment is where Synapse, its workers and Redis all run on one machine, usually for evaluation or a rehearsal of the worker layout. Redis listens on localhost by default, and the Synapse redis settings are disabled until you enable them, so a test setup can often run without authentication because no other host can reach the port. That convenience does not carry into production, and the test configuration should not be copied forward unchanged. Treat the test as a place to confirm that workers connect, replication works and the routing rules behave as planned.

  • Default bind address: Redis on localhost port 6379 is the documented default, and the redis block in homeserver.yaml stays disabled until enabled: true is set.
  • No network exposure: Keep Redis bound to the loopback interface so no other host can open a connection to it.
  • Worker secret still matters: Even on one host, set worker_replication_secret so the replication path is authenticated and the configuration matches production.
  • Do not reuse the test file: Record which settings were relaxed for the test so they are reviewed before go-live.
  • Version check: Confirm the Redis server version you plan to run in production before testing, because the license and ACL behavior differ between release lines.

Before you move to production, confirm the Redis license and release line you will deploy against, using the Redis licensing facts and the Synapse configuration manual.

What worker_replication_secret protects and what it does not

The worker_replication_secret setting authenticates requests that workers send to the main process over the replication channel. Without it, that traffic is not authenticated, so any process that can reach the replication listener can attempt to act as a worker. Treat the secret as a required part of the worker build, not an optional hardening step. Set the same value in the shared Synapse configuration used by the main process and every worker, because a mismatch stops workers from authenticating and the deployment will not replicate correctly. Confirm the exact configuration key and its placement against the Synapse configuration manual before you write your templates.

Generate the value with a cryptographically strong random generator, store it in the same secrets manager or vault you use for database passwords and the Redis password, and inject it into each host at deploy time rather than committing it to configuration repositories. Give it a named owner and record where each copy lives so that rotation covers every main process and worker. Rotation is a coordinated change: plan a window, update the secret everywhere, restart the processes, and verify that workers reconnect. The configuration manual should be the source for the rotation steps your version supports, so confirm them there and test the procedure in a staging copy first.

The secret does not replace network isolation. It proves identity on the replication channel but does not encrypt traffic, hide the listener, or stop a host on the same network from attempting connections. Keep the replication listener on a private network segment, restrict it with host firewall rules, and allow only the main process and workers to reach it. Redis access controls are a separate layer that protects the broker, so decide them alongside this secret rather than in place of it. Ask your team to document which hosts can reach the listener, because that inventory is what a security review will check first.

Which Redis server to run under Synapse

Synapse only needs a Redis-protocol server for worker replication, but the server you pick carries licensing and compatibility consequences that differ by version. The cards below separate the license families and the Valkey fork, and list the checks to complete before choosing one for a production homeserver.

Redis Open Source 8.0 and later

Redis 8.0 and later can be used under a license of your choice among RSALv2, SSPLv1 and AGPLv3. Your legal team should select the license that fits your use, because the choice determines your obligations if you modify Redis and offer it to users as a service. Confirm the version you install against the Synapse release you run, since the Redis choice does not change Synapse's own compatibility requirements.

Redis licenses

Redis 7.4 to 7.8 licensing

Redis 7.4.x through 7.8.x remain under the dual RSALv2 or SSPLv1 license, and neither is OSI-approved. A deployment on these lines needs the same legal review as the 8.x line, but without the AGPLv3 option. Treat this range as a separate license decision rather than assuming it matches the older BSD release.

Redis 7.2 and earlier under BSD-3-Clause

Redis 7.2.x and earlier remain under BSD-3-Clause. The Redis licenses FAQ says teams moving from these versions with unmodified Redis artifacts see no impact. Confirm that your artifacts are unmodified, and record the exact version you deploy, because a later upgrade crosses into a different license family.

Valkey as a BSD-3-Clause alternative

Valkey is BSD-3-Clause licensed and was forked from open-source Redis before the source-available change. It is maintained as an open community project under LF Projects, LLC. Its migration guide says existing Redis client libraries connect without code changes, and that Valkey is compatible with Redis OSS 7.2 and earlier. Valkey 9.1 is the current stable line. Confirm the Valkey version and the Synapse release together in a test environment.

Valkey migration guide

Testing Synapse against each server

The Synapse documentation describes the Redis settings and worker replication, but the supplied material does not confirm support for every Redis or Valkey version. Start a worker test with the exact server version, check replication stream connections, and confirm restart behavior before production. Record the results alongside the Synapse release you tested.

Commercial Redis products are not open source

Redis Software is a self-managed commercial product with added compliance and resiliency features, and Redis Cloud is a managed service on AWS, Google Cloud and Azure. Neither is open source. If you choose either, the contract, support terms and data location become procurement items, and the open-source license analysis above no longer applies.

Where Redis and the replication listener sit in the network

The diagram starts at the client and federation traffic arriving at the reverse proxy, which routes requests to the generic workers and other worker types inside the private zone. Every worker and the main process connect to the Redis server, which relays replication between them, so the replication path never needs to leave the private network. Check that the replication listener, Redis and the worker connections are reachable only from inside the trust boundary, and that the proxy is the only component exposed to clients and remote servers.

Client and federation traffic enters through the proxy, while Redis replication stays inside the private network.

Setting up Redis for a Synapse worker deployment

This sequence takes a monolithic Synapse homeserver to a state where Redis carries replication between the main process and one worker, with access limited to the private network and the connection confirmed in logs. It is the foundation every later worker type depends on.

  1. Review the Redis license and pick a version

    Before installing anything, the platform owner reviews the license for the Redis line you plan to run. Redis 8.0 and later can be used under RSALv2, SSPLv1 or AGPLv3 at your choice, while Redis 7.4.x to 7.8.x are under the dual RSALv2 or SSPLv1 license and Redis 7.2.x and earlier are under BSD-3-Clause. Confirm with your legal and compliance team which license is acceptable, and whether you will run the Valkey fork instead, which is BSD-3-Clause. Record the chosen product and exact version so later upgrades follow the same review. The step is done when the decision and version are written down and approved.

  2. Place Redis on a private subnet

    Install Redis on a host or container that sits only on the private subnet used by your Synapse main process and workers. Do not publish the Redis port on a public address or on the load balancer. Set the Redis bind address to the private interface and turn on protected mode or the equivalent access control for your installation. Confirm the host firewall allows the Redis port only from the Synapse hosts. The check: from a machine outside the private network, a connection attempt to the Redis port should fail, and from a Synapse host it should succeed.

  3. Enable and configure the redis block

    In the Synapse configuration file, set the redis block to enabled, with the host name or address of the private Redis server and its port, which defaults to 6379 on localhost. If Redis requires authentication, set a username where your version supports it and point password_path at a file readable only by the Synapse service account, rather than writing the password inline in the main configuration. Confirm the exact key names and the minimum Synapse version for username and password_path against the configuration manual before you deploy. The check is that Synapse starts without configuration errors and logs a successful connection to Redis.

  4. Set the worker replication secret everywhere

    Generate a long random value and set it as worker_replication_secret in the shared configuration used by the main process and every worker. Store it in your secrets manager and inject it at start, not in version control. Without this value, traffic from workers to the main process is not authenticated, so treat an unset secret as a blocking gap. Confirm every process reads the same value by checking that each configuration loads it and that no process is still running with an older copy. The check is that the secret is present in all process configurations and absent from any file committed to source control.

  5. Confirm the replication listener is not exposed

    Configure the replication listener on the main process so it binds to the private interface only, and make sure the worker replication port is reachable from worker hosts but not from client, federation or public networks. The replication listener is where workers talk to the main process, so an open listener widens the attack surface even with a secret set. Verify with a port scan from a public or untrusted network that the replication port does not answer. The check is a closed result from outside the private network and an open result from a worker host.

  6. Start the main process and one worker

    Start the main process first and confirm it is healthy and connected to Redis. Then start a single worker, using the worker configuration that points at the same Redis server, the same replication secret and the main process replication address. Keep the first worker simple, such as one generic worker, so that any fault is easy to attribute. Use your service manager or container runtime to restart both processes cleanly. The check is that both processes stay running for the observation period you set and that client requests still succeed through the main process.

  7. Verify workers register with the main process

    Read the main process and worker logs and look for the replication connection from the worker to the main process, and for the worker identifying itself as connected through Redis. Confirm the worker name in the log matches the instance_name in its configuration. If the worker does not appear, check the Redis host and port, the password file path, the replication secret and the firewall rules in that order. The step is complete when the log shows the worker registered and a test client request routed through the worker succeeds. Record the log lines and the configuration version as the baseline for the next worker type.

Keeping the replication listener on a private network

The replication listener and Redis carry internal Synapse traffic that was never meant for clients or the public internet. The cards below cover what goes wrong when that boundary slips and the controls that hold it, from the worker replication secret to firewall rules and log review.

Why the listener must stay private

Workers talk to the main process over a replication listener, and Redis relays replication between processes. Traffic on these paths carries internal stream data, so a reachable listener exposes more than the client API does. The replication secret must be set because, when worker_replication_secret is unset, worker requests to the main process are not authenticated. Confirm that every worker config sets the secret before any listener is reachable from another host.

Secret default state
Unset
Synapse configuration manual

Firewall rules for replication and Redis

Allow the replication port and the Redis port only from the IP addresses of the main process and the workers, and deny everything else at the host and network layers. The configuration manual recommends firewalling the federation listener for the same reason, and the same pattern applies here. Check the rules from an untrusted segment, not only from inside the cluster, because a rule that looks correct on paper is often bypassed by a second network path.

Blocking bypass around the reverse proxy

The reverse proxy routes client and federation traffic to the right workers, so it is easy to assume that internal listeners are never reached directly. Confirm that no proxy location forwards replication paths, and that the worker listener ports are not published by a container runtime, load balancer or Kubernetes Service of type that is reachable from outside. Test by connecting to each internal port from a host outside the worker network.

TLS between hosts

When workers run on separate hosts, traffic between them crosses a network that the private boundary does not fully protect. Ask the platform team whether replication and Redis connections can use TLS, and which certificate authority signs them. Where Redis TLS is not configured, rely on network isolation and document that choice as an accepted risk, so reviewers see it as a decision rather than an oversight.

Least-privilege Redis accounts

Redis settings support a username and a password file through password_path, so each deployment can use a dedicated account for Synapse rather than a shared default. Grant that account only the commands and key patterns that Synapse replication needs, and deny administrative commands. Confirm the exact ACL syntax with your Redis or Valkey version, because permission models differ between releases.

Secret storage and rotation

Store the worker replication secret and the Redis password in your secrets manager or in files with restricted ownership, and load them into the config at start. Avoid placing either value in shared Helm values, Git repositories or container images. Plan a rotation procedure that changes the secret on every worker and the main process in one window, because a partial change stops replication until all processes agree.

Log review and detection

Review connection logs from the replication listener and Redis for connections from unexpected addresses, failed authentication attempts and unexpected command use. Forward these logs to the central log platform so that a single host cannot silence them. Decide in advance who receives alerts and which connection sources count as unexpected, since a worker moved to a new subnet can look identical to an intrusion.

Common questions about Redis for Synapse workers

Is Redis required to run Synapse with workers?

Yes, in practice. Synapse uses Redis to relay replication between the main process and its workers, so a worker deployment needs a Redis instance that every process can reach. A single Synapse process on its own does not need it. The Synapse configuration manual documents the redis settings, which default to enabled: false on localhost port 6379, so Redis must be switched on explicitly once you add workers. Plan for it from the start, because the worker layout depends on it.

What does Redis cost, and who pays for each part?

There are three parts to pay for: the Redis software, the hosting, and the implementation work. Redis Open Source is licensed for free use under the terms you choose from the Redis licenses, but you still carry the compliance review of that choice. Hosting is a recurring cost that you pay to your cloud provider or data center, and it grows with the number of Redis nodes you run for high availability. Implementation work is a one-time cost, paid to your team or a partner. Ask any quote to separate these three lines and to state whether monitoring and patching of Redis are included after go-live.

How long does Redis setup take, and what drives the time?

The Redis part is usually a small share of a worker project, but it is not instant. The time depends on whether Redis already runs in your environment, how many Synapse processes must connect, how you handle authentication and network placement, and whether you add Sentinel. Your Synapse config changes, firewall rules and testing of each worker type also add time. No duration is supplied for this work here, so ask a quote for a timeline based on a written scope, and confirm your current Redis and network posture before you agree dates.

What does our team need to provide for a Redis and worker project?

Your team needs to provide access and decisions. That means a named owner for the Synapse homeserver, access to the server configuration and the database, a place to run Redis that your security team approves, and the network rules that keep the replication listener private. You also need someone who can approve the license choice and who will receive alerts once Redis is in production. Without these inputs, a quote will carry assumptions that may change the scope, so list them in the request.

Can our own engineers set up Redis for Synapse workers without a partner?

Yes, a capable platform team can do it, provided it has experience with Synapse configuration, Redis administration and network segmentation. The hard parts are not the first connection. They are keeping the replication listener on a private network, setting the worker replication secret, testing failover, and keeping the worker layout correct as Synapse upgrades change requirements. Decide early whether your team will own those tasks after go-live. If not, a retainer for support and upgrades is a separate scope item to price.

Should we choose Redis or Valkey, and why does license review matter?

Choose on license terms and support, not on the connection protocol alone. Valkey is licensed under BSD-3-Clause and was forked from open-source Redis before Redis moved to source-available licenses. Redis 8.0 and later can be used under RSALv2, SSPLv1 or AGPLv3 at your choice, while Redis 7.4 to 7.8 use the dual RSALv2 or SSPLv1 license, which are not OSI-approved. Existing Redis clients generally connect to Valkey without code changes, but Redis Community Edition 7.4 and later data files are not compatible with Valkey, so a migration needs a different method. Have legal review the license against how you offer the service.

How do we add high availability to Redis with Sentinel?

Sentinel adds automatic failover for Redis when you are not using Redis Cluster. It monitors the master, and when the master fails it promotes a replica. The Redis Sentinel documentation says a robust deployment needs at least three Sentinel instances, so plan for that count and spread them across failure domains. Synapse must then connect through the Sentinel-aware settings, and you should test a forced failover in staging before go-live. Valkey Sentinel follows the same model, so the same design applies if you choose Valkey. Ask any quote to include failover testing in writing.

How do we rotate the worker replication secret safely?

Rotate the worker_replication_secret by changing the value in the shared configuration, then restarting the main process and every worker so they all load the same new value. The setting authenticates worker requests to the main process, and if it is unset that traffic is not authenticated, so never leave it empty. Schedule the change in a maintenance window, because workers that still hold the old value will fail to connect until restarted. Store the secret in your secrets manager, keep the replication listener on a private network, and record the rotation in your change log.

How DeployOpen scopes Redis for Synapse workers

DeployOpen plans and implements Redis for Synapse worker replication inside your own infrastructure, on the cloud accounts, data center hosts or air-gapped network where your Synapse main process and workers run. Before any work starts, the scope is agreed in writing. That document names the Redis topology to be built (a single instance or a Sentinel-managed setup, which the Redis and Valkey Sentinel documentation describe as requiring at least three Sentinel instances for a robust deployment), the Synapse processes that will connect, the network segments involved, the authentication method chosen for Redis and the worker replication secret, and the verification steps that will close the work. Most engagements are fixed-scope, so the deliverables and timelines are fixed in the same document.

During the build, DeployOpen documents the configuration and handles secrets according to your policy, so that your team can review and operate the result without relying on the implementer. In practice that means recording the redis settings in the Synapse configuration, the way the Redis password is supplied (for example through a file referenced by password_path, which the Synapse configuration manual documents), where the worker_replication_secret is stored and who can rotate it, and confirming that the replication listener is reachable only from the private network. The handover covers the Redis and Synapse versions in use, the upgrade path for each, and the runbook for restarting workers. DeployOpen does not issue audit reports or certifications. Where your auditors need evidence of these controls, DeployOpen prepares the configuration and records for their review, and the assessment itself belongs to your independent auditor or certification body.

After go-live, support and retesting can be arranged on a retainer, covering Redis upgrades, Synapse version changes that affect replication, and periodic checks that the listener and secrets remain private. A quote follows from the written scope. To compare offers, ask each provider to state the Redis and Synapse versions it will target, which configuration files it will change, how it will handle secrets, and what it will deliver for retesting.

Sources and further reading

Talk to our team.

Tell us what you're working on, whether it's a deployment, an audit, a security test or a cyber range. You'll speak with an engineer who can help you scope it.

  • 30-minute call: free, with no obligation.
  • NDA on request: we can sign before you share details.
  • Clear next steps: a scope and plan after the call.