From 7a4aacd0103cbf0dc7b8bc3bb604c5820ee7fea8 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Thu, 26 Oct 2023 14:55:51 +0100 Subject: [PATCH] Reduce replication traffic due to reflected cache stream POSITION --- synapse/replication/tcp/resource.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/synapse/replication/tcp/resource.py b/synapse/replication/tcp/resource.py index 1d9a29d22ee6..558728a73021 100644 --- a/synapse/replication/tcp/resource.py +++ b/synapse/replication/tcp/resource.py @@ -27,7 +27,7 @@ from synapse.replication.tcp.commands import PositionCommand from synapse.replication.tcp.protocol import ServerReplicationStreamProtocol from synapse.replication.tcp.streams import EventsStream -from synapse.replication.tcp.streams._base import StreamRow, Token +from synapse.replication.tcp.streams._base import CachesStream, StreamRow, Token from synapse.util.metrics import Measure if TYPE_CHECKING: @@ -205,6 +205,13 @@ async def _run_notifier_loop(self) -> None: # send, so we send a `POSITION` to inform other # workers of the updated position. + # We skip this for the `caches` stream as a) it + # generates a lot of traffic as every worker would + # echo each write, and b) nothing cares if a given + # worker's caches stream position lags. + if stream.NAME == CachesStream.NAME: + continue + # Note: `last_token` may not *actually* be the # last token we sent out in a RDATA or POSITION. # This can happen if we sent out an RDATA for