-
Notifications
You must be signed in to change notification settings - Fork 2.7k
MM-12630 Adding debounce to prevent client breaking for very high rate channels. #2041
Conversation
|
Spinmint test server created at: https://i-0f957e01030fc6a87.test.spinmint.com Test Admin Account: Username: Test User Account: Username: Instance ID: i-0f957e01030fc6a87 |
@lindy65 Can you take a look at this? Should be able to test this with |
@crspeller - yep, will test this today using |
Hey @crspeller Tested by enabling Developer Test Commands in System Console and using Then tested Adding ten times I am posting these test post commands very quickly one after the other with no pause inbetween so am not sure if this is a true simulation of user experience? The channel does not break for over 30 continuous It starts to break again at around 25 continuous Let me know if you need me to test in a different way or whether these results are sufficient? |
@lindy65 That message is fine. The "break" is only for very high frequency channels. The important thing to test is if the client is still usable while the posts are incoming. You can compare the behavior to the behavior on master and you should see the difference. |
Thanks @crspeller Just compared the behavior on |
return null; | ||
}); | ||
dispatch({ | ||
type: PostTypes.RECEIVED_POSTS, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One other thing here, do we know how much of a difference this will have dispatching once vs dispatching repeatedly? I've changed the RECEIVED_POSTS
action from the original code into a new action (something like RECEIVED_NEW_POST
although that name is already taken) that only takes a single post with some of my scrolling-related changes, and I'm wondering if I'll need to add a new RECEIVED_NEW_POSTS
action as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Batching was required to get the performance increases when this code actually fires. Otherwise you get lots of redux updates.
// If the timeout is going this is the second or further event so queue them up. | ||
if (queue.push(args) > 200) { | ||
// Don't run us out of memory, give up if the queue gets insane | ||
queue = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we do this without dumping the entire queue of posts when it becomes overloaded? It might be nice to only ignore any ones over the limit in that case
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This only happens when there are over 200 posts within 100ms of the previous post. Not really worried about not breaking the channel in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah breaking the channel in this case is fine. The goal of this is to not break the entire app when one channel goes nuts.
@hmhealey Ready for re-review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only thing I'm still a bit unsure about is how the batching will affect the changes to the post reducer will affect this, but I can deal with that when the time comes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Spinmint test server destroyed |
Adds a queued denounce function to websocket event handling for new posts. This is an attempt to prevent very high rate channels from breaking the client by overloading it with posts.