-
Notifications
You must be signed in to change notification settings - Fork 12
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
fix large msg sending logic #274
Conversation
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.
Looks good, thanks!
simulations/src/network/mod.rs
Outdated
if should_delay { | ||
let mut cap = node_capacity.current_load.lock(); | ||
let sent = node_capacity.capacity_bps - *cap; | ||
*cap = node_capacity.capacity_bps; | ||
if message.partial_send(sent) == 0 { | ||
let to_node = self.to_node_senders.get(&to).unwrap(); | ||
to_node | ||
.send(message.clone()) | ||
.expect("node should have connection"); | ||
node_capacity.decrease_load(sent); | ||
return false; | ||
} |
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.
Nitpick: can we put this in a named method?
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.
Sure!
081b7f5
to
40453b5
Compare
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
According to @bacv, the problem with the current network throughput is if the message size is bigger than the calculated step throughput, then it never gets sent.
The solution in this PR is "partial send":
e.g.
Let's say, if we have a large message with size 15, and the throughput is 5. In the first step, we mock partially send behavior, so send 5 (remaining message size is 10). In the second step, partially send another 5 (the remaining message size is 5). In the third step, we send the final 5, so the large message can be sent through 3 steps in total.