synapse/tests/handlers
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
..
__init__.py
oidc_test_key.p8 JWT OIDC secrets for Sign in with Apple (#9549) 2021-03-09 15:03:37 +00:00
oidc_test_key.pub.pem JWT OIDC secrets for Sign in with Apple (#9549) 2021-03-09 15:03:37 +00:00
test_admin.py Introduce Clock.call_when_running(...) to include logcontext by default (#18944) 2025-09-22 10:27:59 -05:00
test_appservice.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_auth.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_cas.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_deactivate_account.py Introduce Clock.call_when_running(...) to include logcontext by default (#18944) 2025-09-22 10:27:59 -05:00
test_device.py Port Clock functions to use Duration class (#19229) 2025-12-01 13:55:06 +00:00
test_directory.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_e2e_keys.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_e2e_room_keys.py Remove MockClock() (#18992) 2025-09-30 11:27:29 -05:00
test_federation_event.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_federation.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_message.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_oauth_delegation.py Allow subpaths in MAS endpoints (#19186) 2025-11-18 18:45:33 +00:00
test_oidc.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_password_providers.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_presence.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_profile.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_receipts.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_register.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_room_list.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_room_member.py Implement MSC4380: Invite blocking (#19203) 2025-11-26 16:12:14 +00:00
test_room_policy.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_room_summary.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_room.py Add missing type hints to tests.handlers. (#14680) 2022-12-16 11:53:01 +00:00
test_saml.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_send_email.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_sliding_sync.py Fix sliding sync performance slow down for long lived connections. (#19206) 2025-12-12 10:02:57 +00:00
test_sso.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_stats.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_sync.py Write union types as X | Y where possible (#19111) 2025-11-06 14:02:33 -06:00
test_typing.py Port Clock functions to use Duration class (#19229) 2025-12-01 13:55:06 +00:00
test_user_directory.py Use type hinting generics in standard collections (#19046) 2025-10-22 16:48:19 -05:00
test_worker_lock.py Introduce Clock.call_when_running(...) to include logcontext by default (#18944) 2025-09-22 10:27:59 -05:00