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-56188: Add presence indicator to load test #678

Merged
merged 3 commits into from
Feb 23, 2024
Merged

MM-56188: Add presence indicator to load test #678

merged 3 commits into from
Feb 23, 2024

Conversation

agnivade
Copy link
Member

We send the message via the websocket whenever
the client state changes.

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

@agnivade agnivade added the 2: Dev Review Requires review by a core committer label Dec 13, 2023
@agnivade agnivade added the Do Not Merge/Awaiting PR Awaiting another pull request before merging (e.g. server changes) label Dec 13, 2023
Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

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

I looked at the related server PR (this one, right?) to confirm that UpdateActiveThread does indeed need the channel ID. Why is that? Why don't we need the root post ID? It was quite confusing to see the header of the function being UpdateActiveThread(channelId string) and thought something was wrong.

@agnivade
Copy link
Member Author

I am trying to keep the scope to the high level objects like - teamID, channelID. The rootID is embedded as a metadata to the typing event and is not a property in the WebSocketBroadcast struct. So yes it'll be slightly more wasteful but it keeps the overall logic simple.

We can move to tracking the actual thread maybe as a future perf improvement.

Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

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

Thanks! The only ask I have would be to clarify with a comment in the code why `UpdateActiveThread receives a channel ID instead of a thread ID.

@streamer45
Copy link
Contributor

@agnivade In case you are wondering, I am mostly waiting for the server and client logic to be finalized before reviewing this.

@agnivade
Copy link
Member Author

@streamer45 @agarciamontoro - This can now be reviewed.

Comment on lines +1427 to +1429
// Setting the active thread to empty to allow the optimization to kick in early.
// We don't do this in the webapp to keep the code simple, but it's okay to do this in load-test
// to magnify the boost.
Copy link
Contributor

Choose a reason for hiding this comment

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

When in doubt I'd probably want the load-test simulation to perform worse than webapp to be on the safe side. I'd be okay with keeping this to prove the ideal improvements though.

Copy link
Member

Choose a reason for hiding this comment

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

I'm also a bit worried that we deviate from what the webapp does. Should we just remove this?

Copy link
Member Author

Choose a reason for hiding this comment

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

The problem is our simulation is not close enough to the webapp. We don't differentiate between loading a thread from RHS or from global thread view. It's all just a loadThread action. Until we differentiate that, we'll have to approximate somehow.

Copy link
Member

@agarciamontoro agarciamontoro Jan 19, 2024

Choose a reason for hiding this comment

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

But are we making things more performant here with this piece of code? Or am I misunderstanding its goal and side effects?

Copy link
Member Author

Choose a reason for hiding this comment

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

Correct, we are making it more performant here.

Copy link
Member

Choose a reason for hiding this comment

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

That's what worries me (and what I think concerned Claudio as well). Is the performance improvement in here really needed?

Copy link
Member Author

Choose a reason for hiding this comment

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

I talked about this earlier in this comment: #678 (comment)

Until we do that, we have to approximate somehow. And if we choose not to set the active thread at all, then there will be no improvements at all, so it will be impossible to measure the impact of the change.

Copy link
Member

Choose a reason for hiding this comment

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

Ok, let's go with it then! Thank you for the patience :)

loadtest/user/userentity/websocket.go Outdated Show resolved Hide resolved
@agnivade agnivade requested a review from streamer45 January 18, 2024 05:28
Copy link
Contributor

@streamer45 streamer45 left a comment

Choose a reason for hiding this comment

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

Looks good 👍

Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

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

Looks great! Just blocking because I'm confused with a couple of things I prefer to discuss before merging.

Comment on lines +1427 to +1429
// Setting the active thread to empty to allow the optimization to kick in early.
// We don't do this in the webapp to keep the code simple, but it's okay to do this in load-test
// to magnify the boost.
Copy link
Member

Choose a reason for hiding this comment

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

I'm also a bit worried that we deviate from what the webapp does. Should we just remove this?

Comment on lines +278 to +288
// We don't really have a notion of RHS thread vs global thread in the load test.
// We either load a channel or load a thread. For now, we just set `is_thread_view`
// as both true and false to set the scope.
ue.dataChan <- threadPresenceMsg{
channelId: channelId,
threadView: true,
}
ue.dataChan <- threadPresenceMsg{
channelId: channelId,
threadView: false,
}
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this. What does the webapp do with these two messages?

Copy link
Member Author

Choose a reason for hiding this comment

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

The webapp has 2 different ways of loading a thread. One from RHS and one from global thread viewer. That means one can have 2 threads open at the same time. Since we don't simulate that, we are approximating it here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I get it now, we're simply opening both threads, right? That makes sense, thanks!

Copy link
Member Author

Choose a reason for hiding this comment

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

Basically. Actually we are making the API call to open just a single thread. But we are setting the scope such that both threads are open.

@agarciamontoro agarciamontoro self-requested a review January 31, 2024 12:36
Copy link
Member

@agarciamontoro agarciamontoro left a comment

Choose a reason for hiding this comment

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

🚀

@agnivade agnivade added 4: Reviews Complete All reviewers have approved the pull request and removed 2: Dev Review Requires review by a core committer Do Not Merge/Awaiting PR Awaiting another pull request before merging (e.g. server changes) labels Feb 23, 2024
@agnivade
Copy link
Member Author

The feature PR is merged. Time to get this in!

@agnivade agnivade merged commit 51e020f into master Feb 23, 2024
1 check passed
@agnivade agnivade deleted the addPresence branch February 23, 2024 04:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants