From c913268e13eb0171c85e6567f3a51923204f1495 Mon Sep 17 00:00:00 2001 From: Richard van der Hoff <1389908+richvdh@users.noreply.github.com> Date: Wed, 6 May 2020 17:36:46 +0100 Subject: [PATCH] Make redis go faster with hiredis (#7439) For the record, the reason we need this is as follows: each RDATA command comes down the redis pipe as a subscription message. txredisapi as written needs at least three reactor ticks to read each subscription message from the tcp buffer. Hence, once the process gets loaded, it starts getting behind, and eventually redis knifes the connection. it then takes ages for the master to work its way through the backlog, before it reconnects again, during which any commands from any workers are dropped. --- changelog.d/7439.feature | 1 + synapse/python_dependencies.py | 4 +++- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog.d/7439.feature diff --git a/changelog.d/7439.feature b/changelog.d/7439.feature new file mode 100644 index 000000000000..ce6140fdd111 --- /dev/null +++ b/changelog.d/7439.feature @@ -0,0 +1 @@ +Add support for running replication over Redis when using workers. diff --git a/synapse/python_dependencies.py b/synapse/python_dependencies.py index 733c51b75841..39c99a280230 100644 --- a/synapse/python_dependencies.py +++ b/synapse/python_dependencies.py @@ -98,7 +98,9 @@ "sentry": ["sentry-sdk>=0.7.2"], "opentracing": ["jaeger-client>=4.0.0", "opentracing>=2.2.0"], "jwt": ["pyjwt>=1.6.4"], - "redis": ["txredisapi>=1.4.7"], + # hiredis is not a *strict* dependency, but it makes things much faster. + # (if it is not installed, we fall back to slow code.) + "redis": ["txredisapi>=1.4.7", "hiredis"], } ALL_OPTIONAL_REQUIREMENTS = set() # type: Set[str]