Skip to content
This repository has been archived by the owner on Nov 25, 2024. It is now read-only.

Only fetch events once for all rooms #3311

Merged
merged 5 commits into from
Jan 25, 2024
Merged

Conversation

recht
Copy link
Contributor

@recht recht commented Jan 22, 2024

This refactors PDUStreamProvider a bit so that it doesn't trigger a database query per room, but instead utilizes the fact that it's possible to bulk query. This improves sync performance significantly when you have 1000s of rooms.

Pull Request Checklist

Signed-off-by: Joakim Recht <joakim@beyondwork.ai>

@recht recht requested a review from a team as a code owner January 22, 2024 14:37
@S7evinK
Copy link
Contributor

S7evinK commented Jan 23, 2024

I think I tried something similar, but that made Sytest unhappy with regards to newly joined rooms on incremental syncs.

Copy link

codecov bot commented Jan 23, 2024

Codecov Report

Attention: 41 lines in your changes are missing coverage. Please review.

Comparison is base (7863a40) 65.71% compared to head (c48a7aa) 65.85%.
Report is 26 commits behind head on main.

Files Patch % Lines
syncapi/streams/stream_pdu.go 29.31% 34 Missing and 7 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3311      +/-   ##
==========================================
+ Coverage   65.71%   65.85%   +0.13%     
==========================================
  Files         507      509       +2     
  Lines       57291    58904    +1613     
==========================================
+ Hits        37651    38793    +1142     
- Misses      15830    16207     +377     
- Partials     3810     3904      +94     
Flag Coverage Δ
unittests 50.05% <29.31%> (+0.54%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@recht
Copy link
Contributor Author

recht commented Jan 23, 2024

I think I tried something similar, but that made Sytest unhappy with regards to newly joined rooms on incremental syncs.

Hmm yes I see - I have changed it a bit so that it handles the newly joined case too, and that seems to make tests run locally at least.

@recht
Copy link
Contributor Author

recht commented Jan 23, 2024

I see a build is still failing, but I'm not sure the failure is related to my change?

@S7evinK
Copy link
Contributor

S7evinK commented Jan 23, 2024

Looks more like GHA being upset. Started a retry.

Copy link
Contributor

@S7evinK S7evinK left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you!
I'd like to test this on my server for a bit before merging, but my server is down as of today.. (disc I/O issues, as it seems :/)

@S7evinK
Copy link
Contributor

S7evinK commented Jan 24, 2024

Right, so regarding speed, it doesn't seem to change that much (well, at least for my few rooms). Most of the time is spent in GetStateDeltas (when setting the PDU token to current - 100k), but that may be something for a different PR.

@recht
Copy link
Contributor Author

recht commented Jan 24, 2024

I expect for a few rooms it doesn't make any noticeable difference, but if you have many (1000s) it's very significant

@S7evinK S7evinK merged commit 00217a6 into matrix-org:main Jan 25, 2024
19 of 20 checks passed
@S7evinK
Copy link
Contributor

S7evinK commented Jan 25, 2024

Thank you for this! :)

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants