mirror of
https://github.com/element-hq/synapse.git
synced 2024-12-14 11:57:44 +00:00
adda2a4613
Spawning from @kegsay [pointing out](https://matrix.to/#/!cnVVNLKqgUzNTOFQkz:matrix.org/$ExOO7J8uPUQSyH-9Uxc_QCa8jlXX9uK4VRtkSC0EI3o?via=element.io&via=matrix.org&via=jki.re) that the Sliding Sync endpoint doesn't handle a large room with a lot of state well on initial sync (requesting all state via `required_state: [ ["*","*"] ]`) (it just takes forever). After investigating further, the slow part is just `get_events_as_list(...)` fetching all of the current state ID's out for the room (which can be 100k+ events for rooms with a lot of membership). This is just a slow thing in Synapse in general and the same thing happens in Sync v2 or the `/state` endpoint. --- The only idea I had to improve things was to use `batch_iter` to only try fetching a fixed amount at a time instead of working with large maps, lists, and sets. This doesn't seem to have much effect though. There is already a `batch_iter(event_ids, 200)` in `_fetch_event_rows(...)` for when we actually have to touch the database and that's inside a queue to deduplicate work. I did notice one slight optimization to use `get_events_as_list(...)` directly instead of `get_events(...)`. `get_events(...)` just turns the result from `get_events_as_list(...)` into a dict and since we're just iterating over the events, we don't need the dict/map. |
||
---|---|---|
.. | ||
databases | ||
util | ||
__init__.py | ||
test__base.py | ||
test_account_data.py | ||
test_appservice.py | ||
test_background_update.py | ||
test_base.py | ||
test_cleanup_extrems.py | ||
test_client_ips.py | ||
test_database.py | ||
test_devices.py | ||
test_directory.py | ||
test_e2e_room_keys.py | ||
test_end_to_end_keys.py | ||
test_event_chain.py | ||
test_event_federation.py | ||
test_event_metrics.py | ||
test_event_push_actions.py | ||
test_events.py | ||
test_id_generators.py | ||
test_main.py | ||
test_monthly_active_users.py | ||
test_profile.py | ||
test_purge.py | ||
test_receipts.py | ||
test_redaction.py | ||
test_registration.py | ||
test_relations.py | ||
test_rollback_worker.py | ||
test_room.py | ||
test_room_search.py | ||
test_roommember.py | ||
test_sliding_sync_tables.py | ||
test_state.py | ||
test_stream.py | ||
test_transactions.py | ||
test_txn_limit.py | ||
test_unsafe_locale.py | ||
test_user_directory.py | ||
test_user_filters.py |