Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lots of join parts lead to bad room performance #9061

Closed
freaktechnik opened this issue Mar 6, 2019 · 7 comments · Fixed by matrix-org/matrix-react-sdk#6143
Closed

Lots of join parts lead to bad room performance #9061

freaktechnik opened this issue Mar 6, 2019 · 7 comments · Fixed by matrix-org/matrix-react-sdk#6143
Labels
A-Performance A-Timeline P2 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect

Comments

@freaktechnik
Copy link

Description

Rooms with primarily joins and parts and few actual messages seem to get extremely slow. So slow even, that Firefox warns about the site not responding sometimes.

Steps to reproduce

  • Go to room with lots of joins/parts
  • Wait for messages like "Ndtm left and rejoined, rapt0r (IRC) and 342 others joined and left, ePirat (IRC) and 14 others joined, TheSchaf (IRC) and 4 others joined and left 2 times" to be generated

I don't have an example of a public room with messages like that, but I'm sure there's some room in the federation with a similar issue.

I am sure it's related to joins/parts since the performance of the particular room has been getting worse the more there are. It feels like there is an O(n^2) implementation here of something that could probably be done in O(n) but that's just a guess without actually looking at all.

I'll happily test this more (like testing it on staging), provide specific details and possibly even contribute a patch for this.

Log: not sent

Version information

  • Platform: web
  • Browser: Firefox Nightly
  • OS: elementaryOS
  • URL: riot.im/app
@lampholder
Copy link
Member

I think this is because riot tries to render a page full of events, but joins/parts get compressed at render time (by which I mean physically compressed on the screen) so riot has to keep pulling in more and more room events to fill up the whole screen.

@lampholder lampholder added T-Defect A-Performance P2 S-Major Severely degrades major functionality or product features, with no satisfactory workaround A-Timeline labels Mar 14, 2019
@dcermak
Copy link

dcermak commented Jun 1, 2021

This issue is still present in the current Element version and it got exponentially worse in rooms that were bridged to freenode and moved to libera.chat, as there is a huge number of join/leave events. If you have the setting "hide join/leave events" enabled, then you literally cannot do anything in such a room as Element will just hang even on a very beefy machine.

The Element Android App and other clients like NeoChat don't appear to be affected by this.

@decathorpe
Copy link

Yeah, with users leaving freenode for libera.chat and / or matrix directly, this is now very very bad in rooms like #fedora-devel:matrix.org, where opening it hangs my browser for minutes trying to fill the chat window with messages, consuming almost 2 entire CPU cores during that time, rendering those rooms (and the entire browser) completely unusable.

Browser: firefox 88.0.1 with WebRender enabled
OS: Fedora 34 Worksatation / GNOME on X.org
Hardware: Ryzen 7 5800X CPU with 32 GB of very fast RAM, so that should not be an issue

@robintown
Copy link
Member

@dcermak @decathorpe I am trying to fix this in matrix-org/matrix-react-sdk#6143, however I have not been able to quite reproduce the claims of ~1 minute hangs that you are reporting. Could you please try the build at https://deploy-preview-6143--matrix-react-sdk.netlify.app/ and see whether it has solved your issue? If not, please use your browser's devtools to do a performance recording of such a hang happening, and export that recording and upload it here.

@decathorpe
Copy link

Looks like it only happens if there are a lot of join / part messages from the IRC side of a bridge but very few actual messages. Then if you toggle the option to hide the join / part events, performance goes downhill with element fetching loads of messages to fill the window, but hiding most of them, as far as I can tell.

But the #fedora-devel:matrix.org room is also no longer affected, since there's now actual chat activity and fewer join/leave things happening, so I don't have an example room to test this with any longer :(

@freaktechnik
Copy link
Author

When I had initially reported this I recall seeing the aggregation part of the membership messages being really slow (since it would get updated for each event separately or something) thus my vague statements in the original report. I think that'd be the code now at https://github.com/matrix-org/matrix-react-sdk/blob/develop/src/components/views/elements/MemberEventListSummary.tsx . However I haven't seen a big IRC netsplit type of event to reproduce this since.

@robintown
Copy link
Member

@decathorpe But the #fedora-devel:matrix.org room is also no longer affected, since there's now actual chat activity and fewer join/leave things happening, so I don't have an example room to test this with any longer :(

If you scroll back to the start of Thursday last week in that room there should be plenty of joins/leaves to test this against, they don't need to be current. I just really want to have feedback from someone who was experiencing hangs, since that's my best lead in solving this issue for good.

su-ex added a commit to SchildiChat/element-web that referenced this issue Sep 1, 2022
* Device manager - scroll to filtered list from security recommendations ([\element-hq#9227](matrix-org/matrix-react-sdk#9227)). Contributed by @kerryarchibald.
* Device manager - updated dropdown style in filtered device list ([\element-hq#9226](matrix-org/matrix-react-sdk#9226)). Contributed by @kerryarchibald.
* Device manager - device type and verification icons on device tile ([\element-hq#9197](matrix-org/matrix-react-sdk#9197)). Contributed by @kerryarchibald.
* Ignore unreads in low priority rooms in the space panel ([\element-hq#6518](matrix-org/matrix-react-sdk#6518)). Fixes element-hq#16836.
* Release message right-click context menu out of labs ([\element-hq#8613](matrix-org/matrix-react-sdk#8613)).
* Device manager - expandable session details in device list ([\element-hq#9188](matrix-org/matrix-react-sdk#9188)). Contributed by @kerryarchibald.
* Device manager - device list filtering ([\element-hq#9181](matrix-org/matrix-react-sdk#9181)). Contributed by @kerryarchibald.
* Device manager - add verification details to session details ([\element-hq#9187](matrix-org/matrix-react-sdk#9187)). Contributed by @kerryarchibald.
* Device manager - current session expandable details ([\element-hq#9185](matrix-org/matrix-react-sdk#9185)). Contributed by @kerryarchibald.
* Device manager - security recommendations section ([\element-hq#9179](matrix-org/matrix-react-sdk#9179)). Contributed by @kerryarchibald.
* The Welcome Home Screen: Return Button ([\element-hq#9089](matrix-org/matrix-react-sdk#9089)). Fixes element-hq#22917. Contributed by @justjanne.
* Device manager - label devices as inactive ([\element-hq#9175](matrix-org/matrix-react-sdk#9175)). Contributed by @kerryarchibald.
* Device manager - other sessions list ([\element-hq#9155](matrix-org/matrix-react-sdk#9155)). Contributed by @kerryarchibald.
* Implement MSC3846: Allowing widgets to access TURN servers ([\element-hq#9061](matrix-org/matrix-react-sdk#9061)).
* Allow widgets to send/receive to-device messages ([\element-hq#8885](matrix-org/matrix-react-sdk#8885)).
* Add super cool feature ([\element-hq#9222](matrix-org/matrix-react-sdk#9222)). Contributed by @gefgu.
* Make use of js-sdk roomNameGenerator to handle i18n for generated room names ([\element-hq#9209](matrix-org/matrix-react-sdk#9209)). Fixes element-hq#21369.
* Fix progress bar regression throughout the app ([\element-hq#9219](matrix-org/matrix-react-sdk#9219)). Fixes element-hq#23121.
* Reuse empty string & space string logic for event types in devtools ([\element-hq#9218](matrix-org/matrix-react-sdk#9218)). Fixes element-hq#23115.
* Reduce amount of requests done by the onboarding task list ([\element-hq#9194](matrix-org/matrix-react-sdk#9194)). Fixes element-hq#23085. Contributed by @justjanne.
* Avoid hardcoding branding in user onboarding ([\#9206](matrix-org/matrix-react-sdk#9206)). Fixes element-hq#23111. Contributed by @justjanne.
* End jitsi call when member is banned ([\element-hq#8879](matrix-org/matrix-react-sdk#8879)). Contributed by @maheichyk.
* Fix context menu being opened when clicking message action bar buttons ([\element-hq#9200](matrix-org/matrix-react-sdk#9200)). Fixes element-hq#22279 and element-hq#23100.
* Add gap between checkbox and text in report dialog following the same pattern (8px) used in the gap between the two buttons. It fixes element-hq#23060 ([\element-hq#9195](matrix-org/matrix-react-sdk#9195)). Contributed by @gefgu.
* Fix url preview AXE and layout issue & add percy test ([\element-hq#9189](matrix-org/matrix-react-sdk#9189)). Fixes element-hq#23083.
* Wrap long space names ([\element-hq#9201](matrix-org/matrix-react-sdk#9201)). Fixes element-hq#23095.
* Attempt to fix `Failed to execute 'removeChild' on 'Node'` ([\element-hq#9196](matrix-org/matrix-react-sdk#9196)).
* Fix soft crash around space hierarchy changing between spaces ([\element-hq#9191](matrix-org/matrix-react-sdk#9191)). Fixes matrix-org/element-web-rageshakes#14613.
* Fix soft crash around room view store metrics ([\element-hq#9190](matrix-org/matrix-react-sdk#9190)). Fixes matrix-org/element-web-rageshakes#14361.
* Fix the same person appearing multiple times when searching for them. ([\element-hq#9177](matrix-org/matrix-react-sdk#9177)). Fixes element-hq#22851.
* Fix space panel subspace indentation going missing ([\element-hq#9167](matrix-org/matrix-react-sdk#9167)). Fixes element-hq#23049.
* Fix invisible power levels tile when showing hidden events ([\element-hq#9162](matrix-org/matrix-react-sdk#9162)). Fixes element-hq#23013.
* Space panel accessibility improvements ([\element-hq#9157](matrix-org/matrix-react-sdk#9157)). Fixes element-hq#22995.
* Fix inverted logic for showing UserWelcomeTop component ([\element-hq#9164](matrix-org/matrix-react-sdk#9164)). Fixes element-hq#23037.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Performance A-Timeline P2 S-Major Severely degrades major functionality or product features, with no satisfactory workaround T-Defect
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants