synapse/tests
Erik Johnston dfd00a986f
Fix sliding sync performance slow down for long lived connections. (#19206)
Fixes https://github.com/element-hq/synapse/issues/19175

This PR moves tracking of what lazy loaded membership we've sent to each
room out of the required state table. This avoids that table from
continuously growing, which massively helps performance as we pull out
all matching rows for the connection when we receive a request.

The new table is only read when we have data in a room to send, so we
end up reading a lot fewer rows from the DB. Though we now read from
that table for every room we have events to return in, rather than once
at the start of the request.

For an explanation of how the new table works, see the
[comment](https://github.com/element-hq/synapse/blob/erikj/sss_better_membership_storage2/synapse/storage/schema/main/delta/93/02_sliding_sync_members.sql#L15-L38)
on the table schema.

The table is designed so that we can later prune old entries if we wish,
but that is not implemented in this PR.

Reviewable commit-by-commit.

---------

Co-authored-by: Eric Eastwood <erice@element.io>
2025-12-12 10:02:57 +00:00
..
api Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
app Be able to shutdown homeserver that hasn't setup (#19187) 2025-12-02 10:58:06 -06:00
appservice Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
config Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
crypto Be able to shutdown homeserver that hasn't setup (#19187) 2025-12-02 10:58:06 -06:00
events Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
federation Fix v12 rooms when using frozen dicts (#19235) 2025-12-01 18:26:43 +00:00
handlers Fix sliding sync performance slow down for long lived connections. (#19206) 2025-12-12 10:02:57 +00:00
http Respond with useful error codes when Content-Length header/s are invalid (#19212) 2025-12-08 21:39:18 +00:00
logging Port Clock functions to use Duration class (#19229) 2025-12-01 13:55:06 +00:00
media Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
metrics Move towards a dedicated Duration class (#19223) 2025-11-26 10:56:59 +00:00
module_api Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
push Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
replication Port Clock functions to use Duration class (#19229) 2025-12-01 13:55:06 +00:00
rest Fix sliding sync performance slow down for long lived connections. (#19206) 2025-12-12 10:02:57 +00:00
scripts Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
server_notices Port Clock functions to use Duration class (#19229) 2025-12-01 13:55:06 +00:00
state Port Clock functions to use Duration class (#19229) 2025-12-01 13:55:06 +00:00
storage Fix sliding sync performance slow down for long lived connections. (#19206) 2025-12-12 10:02:57 +00:00
synapse_rust Wrap the Rust HTTP client with make_deferred_yieldable (#18903) 2025-10-02 13:00:50 -05:00
test_utils Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
types Support for room version 12 2025-08-11 16:43:45 +01:00
util Port Clock functions to use Duration class (#19229) 2025-12-01 13:55:06 +00:00
__init__.py Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
server.py Respond with useful error codes when Content-Length header/s are invalid (#19212) 2025-12-08 21:39:18 +00:00
test_distributor.py Cleanly shutdown SynapseHomeServer object (#18828) 2025-10-01 02:42:09 +00:00
test_event_auth.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_mau.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_phone_home.py Move unique snowflake homeserver background tasks to start_background_tasks (#19037) 2025-10-13 10:19:09 -05:00
test_rust.py Add missing type hints to tests. (#15027) 2023-02-08 19:52:37 +00:00
test_server.py Respond with useful error codes when Content-Length header/s are invalid (#19212) 2025-12-08 21:39:18 +00:00
test_state.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_terms_auth.py Introduce Clock.call_when_running(...) to include logcontext by default (#18944) 2025-09-22 10:27:59 -05:00
test_types.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_visibility.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
unittest.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
utils.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00