From 02a147039cc1694b1ea3d80636697b11e6a4461b Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 9 Feb 2024 10:51:00 +0000 Subject: [PATCH 1/2] Increase batching when fetching auth chains (#16893) This basically reverts a change that was in https://github.com/element-hq/synapse/pull/16833, where we reduced the batching. The smaller batching can cause performance issues on busy servers and databases. --- changelog.d/16893.bugfix | 1 + synapse/storage/databases/main/event_federation.py | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) create mode 100644 changelog.d/16893.bugfix diff --git a/changelog.d/16893.bugfix b/changelog.d/16893.bugfix new file mode 100644 index 000000000..7222cd765 --- /dev/null +++ b/changelog.d/16893.bugfix @@ -0,0 +1 @@ +Fix performance regression when fetching auth chains from the DB. Introduced in v1.100.0. diff --git a/synapse/storage/databases/main/event_federation.py b/synapse/storage/databases/main/event_federation.py index 12e882062..846c3f363 100644 --- a/synapse/storage/databases/main/event_federation.py +++ b/synapse/storage/databases/main/event_federation.py @@ -310,7 +310,7 @@ class EventFederationWorkerStore(SignatureWorkerStore, EventsWorkerStore, SQLBas # Add all linked chains reachable from initial set of chains. chains_to_fetch = set(event_chains.keys()) while chains_to_fetch: - batch2 = tuple(itertools.islice(chains_to_fetch, 100)) + batch2 = tuple(itertools.islice(chains_to_fetch, 1000)) chains_to_fetch.difference_update(batch2) clause, args = make_in_list_sql_clause( txn.database_engine, "origin_chain_id", batch2 @@ -593,7 +593,7 @@ class EventFederationWorkerStore(SignatureWorkerStore, EventsWorkerStore, SQLBas # the loop) chains_to_fetch = set(seen_chains) while chains_to_fetch: - batch2 = tuple(itertools.islice(chains_to_fetch, 100)) + batch2 = tuple(itertools.islice(chains_to_fetch, 1000)) clause, args = make_in_list_sql_clause( txn.database_engine, "origin_chain_id", batch2 ) From 2252bae3df89842f5c2fe4edd6367ec13b3655d2 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 13 Feb 2024 10:45:40 +0000 Subject: [PATCH 2/2] 1.101.0 --- CHANGES.md | 9 +++++++++ changelog.d/16893.bugfix | 1 - debian/changelog | 6 ++++++ pyproject.toml | 2 +- 4 files changed, 16 insertions(+), 2 deletions(-) delete mode 100644 changelog.d/16893.bugfix diff --git a/CHANGES.md b/CHANGES.md index e48e97eef..9fedd5797 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -1,3 +1,12 @@ +# Synapse 1.101.0 (2024-02-13) + +### Bugfixes + +- Fix performance regression when fetching auth chains from the DB. Introduced in v1.100.0. ([\#16893](https://github.com/element-hq/synapse/issues/16893)) + + + + # Synapse 1.101.0rc1 (2024-02-06) ### Improved Documentation diff --git a/changelog.d/16893.bugfix b/changelog.d/16893.bugfix deleted file mode 100644 index 7222cd765..000000000 --- a/changelog.d/16893.bugfix +++ /dev/null @@ -1 +0,0 @@ -Fix performance regression when fetching auth chains from the DB. Introduced in v1.100.0. diff --git a/debian/changelog b/debian/changelog index 48604eb1d..33a658b66 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +matrix-synapse-py3 (1.101.0) stable; urgency=medium + + * New Synapse release 1.101.0. + + -- Synapse Packaging team Tue, 13 Feb 2024 10:45:35 +0000 + matrix-synapse-py3 (1.101.0~rc1) stable; urgency=medium * New Synapse release 1.101.0rc1. diff --git a/pyproject.toml b/pyproject.toml index 4bd443969..cd8bb3942 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -96,7 +96,7 @@ module-name = "synapse.synapse_rust" [tool.poetry] name = "matrix-synapse" -version = "1.101.0rc1" +version = "1.101.0" description = "Homeserver for the Matrix decentralised comms protocol" authors = ["Matrix.org Team and Contributors "] license = "AGPL-3.0-or-later"