summary refs log tree commit diff
path: root/docs/usage/configuration/config_documentation.md
diff options
context:
space:
mode:
authorErik Johnston <erikj@element.io>2024-09-30 13:52:33 +0100
committerGitHub <noreply@github.com>2024-09-30 13:52:33 +0100
commit81e0f57800590e63bbc07319db6da964595978d0 (patch)
treeb8da130c37d3d5cab692524b2d4e4998b7f13d4d /docs/usage/configuration/config_documentation.md
parentOptimise notifier mk2 (#17766) (diff)
downloadsynapse-81e0f57800590e63bbc07319db6da964595978d0.tar.xz
Fix perf when streams don't change often (#17767)
There is a bug with the `StreamChangeCache` where it would incorrectly
return that all entities had changed if asked for entities changed
*since* the earliest stream position.

Note that for streams we use the inequalities: `$min_stream_id <
stream_id <= $max_stream_id`, i.e. when we ask the stream change cache
for all things that have changed since `$stream_id` we don't care for
events that happened *at* `$stream_id`.

Specifically: `_earliest_known_stream_pos` is the position at which we
know that we'll have entries for all changes since that point, we can
use the cache for any stream IDs that equal
`_earliest_known_stream_pos`.

`_earliest_known_stream_pos` is set in three places:
- On startup we set it either to:
  - the current maximum stream ID, with not prefilled values; or
  - the minimum of the latest N values we pulled from the DB
- When we evict items from the bottom, we set it to the stream ID of the
evicted items.

This was changed in https://github.com/matrix-org/synapse/pull/14435,
but I think we were overly conservative there.

---------

Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
Diffstat (limited to 'docs/usage/configuration/config_documentation.md')
0 files changed, 0 insertions, 0 deletions