-
Notifications
You must be signed in to change notification settings - Fork 15
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
code: Add jitter before emitting RPC requests #585
Comments
Hey @romac! Thinking of diving deep into Malachite over the winter break. Can I take this up? |
Of course, have at it! :) |
But this would slow down clients even in the absence of multiple concurrent requests to the same service. Shouldn't be the server to handle this situation? |
The delay would be small. And this should only apply for voteSet and Value requests where it wouldn't matter. Would also work for a single client sending multiple requests to different servers. But, indeed the server should also handle it. |
Hey @romac , @ancazamfir, could you please provide more context about this issue? |
For synchronization purposes, we sometimes need to send requests to other nodes, and would like to add some jitter before sending those avoid overwhelming a node in the case where multiple nodes are falling behind at the same time and are all picking the same node to send sync requests to. This could happen if only a few nodes managed to move to the next height and all others are left behind. Here is the place in the code where we send those requests and where the jitter should be added:
|
Thanks, @romac! How do nodes decide who to send the request to? Was this issue raised based on a situation you’ve already encountered in some experiments? |
iirc it started when @romac and i had a discussion about blocksync where for each request we also have a retry mechanism. And I recalled then that in my past workplace was mandatory that all timeouts were randomized, messages were jittered, timeouts were adaptive, etc. depending on the situation. All this to avoid synchronization of message sending at different nodes and avoid bursts of traffic. There was a very good writeup about this, something about positive feedback loops (??) but could not find it quickly. And I'm sure you are all familiar.
Not really although when testing with multiple nodes syncing I remember seeing that at some point a node would get many requests in the same time. This was when we were not picking random peers. I also believe that we might see this in consensus network. In general we should maybe do some proper testing and analysis before we implement a solution. |
They just randomly pick a peer who is known to be at a higher height. |
Thanks, @ancazamfir and @romac, for the clarifications! During my experiments with Byzantine attacks on BFT consensus in a WAN setup, I observed that the success of an attack often depended on the timing of its launch (i.e., when specific messages were sent). Introducing additional jitter before sending messages didn’t have a significant impact. The reason was that the network latencies between nodes already introduced natural jitter, causing nodes to reach the same execution point at different times. This is why I initially believed that additional jitter might not be necessary and that random peer selection would suffice. However, this was a different setup, and I agree with Anca that conducting prior testing and analysis would be the best way to determine whether it is truly necessary or not. |
@nenadmilosevic95 good point on latencies on WAN setup. Maybe we can close this issue and re-open if needed? wdyt @romac ? |
To avoid a synchronized swarm of client requests hitting the same nodes, we should add some jitter to outbound requests, for example by sleeping for a random amount of time before sending a request.
The text was updated successfully, but these errors were encountered: