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

[MM-53455] Broadcast certain call events to participants only #609

Merged
merged 5 commits into from May 23, 2024

Conversation

streamer45
Copy link
Contributor

Summary

The original idea was to minimize websocket events we are sending out since most of them are broadcast to the entire channel even though it's likely that only a subset of members are in the call and plenty of these events are unneeded by clients not connected to the call (e.g. mute/unmute and other session state changes).

However, to optimize this we need to have the list of participants which in certain cases means an additional call to the database to fetch the call state. Also model.WebsocketBroadcast doesn't support a slice of user ids so we need to loop on PublishWebSocketEvent from the plugin side.

Even though the reasoning behind this PR makes total sense from a logical perspective (avoid sending out unnecessary data), the above practical reasons make me doubt a little on whether the changes are actually worth the tradeoffs from a performance standpoint. Will need to load-test a bit and how this behaves at scale.

Ticket Link

https://mattermost.atlassian.net/browse/MM-53455

@streamer45 streamer45 added 2: Dev Review Requires review by a core committer Do Not Merge / Awaiting Perf Test labels Jan 4, 2024
@streamer45 streamer45 added this to the v0.23.0 / MM 9.5 milestone Jan 4, 2024
@streamer45 streamer45 requested a review from cpoile January 4, 2024 21:57
@streamer45 streamer45 self-assigned this Jan 4, 2024
@codecov-commenter
Copy link

codecov-commenter commented Jan 4, 2024

Codecov Report

Attention: Patch coverage is 13.62007% with 241 lines in your changes are missing coverage. Please review.

Project coverage is 16.10%. Comparing base (ee1d610) to head (c6938d1).
Report is 15 commits behind head on main.

Files Patch % Lines
server/websocket.go 30.68% 61 Missing ⚠️
server/recording_api.go 0.00% 60 Missing ⚠️
server/transcription_api.go 0.00% 41 Missing ⚠️
server/session.go 0.00% 37 Missing ⚠️
server/bot_api.go 0.00% 20 Missing ⚠️
server/rtcd.go 0.00% 11 Missing ⚠️
server/host_controls.go 0.00% 5 Missing ⚠️
server/api.go 0.00% 3 Missing ⚠️
server/plugin.go 0.00% 2 Missing ⚠️
server/state.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #609      +/-   ##
==========================================
+ Coverage   11.05%   16.10%   +5.05%     
==========================================
  Files          27       38      +11     
  Lines        5690     6624     +934     
==========================================
+ Hits          629     1067     +438     
- Misses       5003     5437     +434     
- Partials       58      120      +62     

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

Copy link
Member

@cpoile cpoile left a comment

Choose a reason for hiding this comment

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

Should be interesting to see the numbers; code looks good.

@streamer45 streamer45 added 3: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer labels Jan 8, 2024
@streamer45 streamer45 removed this from the v0.24.0 / MM 9.6 milestone Jan 23, 2024
@streamer45 streamer45 added the 2: Dev Review Requires review by a core committer label Apr 8, 2024
@streamer45 streamer45 changed the base branch from main to MM-42464 April 8, 2024 20:34
@streamer45
Copy link
Contributor Author

@cpoile I've pretty much redone this from scratch to work on top of the new changes, will need a new review.

@streamer45 streamer45 requested a review from cpoile April 8, 2024 20:37
@streamer45 streamer45 added this to the v0.27.0 / MM 9.9 milestone Apr 9, 2024
Base automatically changed from MM-42464 to main April 11, 2024 19:05
@streamer45 streamer45 removed the 3: Reviews Complete All reviewers have approved the pull request label Apr 11, 2024
@streamer45
Copy link
Contributor Author

@cpoile Just a reminder this is ready for re-review.

Copy link
Member

@cpoile cpoile left a comment

Choose a reason for hiding this comment

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

Nice, thank you! I guess the only question I would have is: if we're worried about the performance implications, would it be better to add an option to the server's own method to broadcast to a slice of userIDs? (in the future of course)

@streamer45
Copy link
Contributor Author

Nice, thank you! I guess the only question I would have is: if we're worried about the performance implications, would it be better to add an option to the server's own method to broadcast to a slice of userIDs? (in the future of course)

Yes, ideally we'd do that to avoid some of the penalty of having to loop through RPC calls.

@streamer45 streamer45 removed the 2: Dev Review Requires review by a core committer label May 1, 2024
@streamer45 streamer45 merged commit 67dc5ba into main May 23, 2024
19 checks passed
@streamer45 streamer45 deleted the MM-53455 branch May 23, 2024 22:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants