JohnXLivingston / peertube-plugin-livechat

GNU Affero General Public License v3.0
90 stars 26 forks source link

Converse/Prosody optimization: don't use vCards for avatars, but custom front-end code. #106

Closed JohnXLivingston closed 7 months ago

JohnXLivingston commented 1 year ago

Is your feature request related to a problem? Please describe. Displaying avatars for chat user currently use the XMPP vCards. This can induce a heavy load: each time a user joins, he will ask for all other users vCards. When hundreds of users join at the same time it can be an issue. For people using the web interface, we could shortcut the XMPP server/vcards to directly get avatars from Peertube, and/or we should lazy-load them when they are actually displayed.

NlNet expert suggested to add some lazy loading for avatars. We could for example remove avatars from user list, and just load them when users are sending messages.

To avoid performance issue on very large rooms, @jcbrand suggest the following: https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/95#issuecomment-1253621683

Describe the solution you'd like Here is the solution I suggested (but better ideas have come up later on): https://github.com/JohnXLivingston/peertube-plugin-livechat/issues/95#issuecomment-1253636691

Reference: NlNet-task-12

JohnXLivingston commented 7 months ago

Here are some performance tests, concerning a first implementation test: https://github.com/JohnXLivingston/livechat-perf-test/tree/main/tests/40-dont-load-unecessary-vards

Needs more tweaking.

JohnXLivingston commented 7 months ago

Finally i didn't implement front-end avatar loading. This could add some privacy issues:

So i only implemented a sort of lazy-loading: we don't load all vCards/avatars when the participant list is hidden (which is the case by default when you join a chat).

I also optimized Peertube user parallel loading (see #309).

So, to fix this issue, here are the involved commits:

And here some performance measurements: https://github.com/JohnXLivingston/livechat-perf-test/tree/main/tests/40-dont-load-unecessary-vards#run-02