-
Notifications
You must be signed in to change notification settings - Fork 267
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
test: measures the max receive rate and adds a test to ensure the max rate is observed #1119
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.
we should probably remove these print statements, but other than that LGTM!
p2p/conn/connection_test.go
Outdated
require.Nil(t, err) | ||
defer serverConn.Stop() //nolint:errcheck // ignore for tests | ||
|
||
msgSize := int(cnfg.RecvRate) |
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.
Don't we want a message size to be greater than the RecvRate
so we can assert that MConnection
correctly throttles the messages to that peer
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 reason of why msgSize
equal to cnfg.RecvRate
would serve the purpose of this test is that the traffic rate is actually enforced roughly for every 100 ms (with the max traffic rate of RecvRate/10
), and, roughly speaking, the peak rate is also measured based on the traffic rate observed in each 100 ms intervals. As such, a message size configured with cnfg.RecvRate
can still lead to a sudden increase in traffic for a 100 ms interval hence resulting in a higher peak rate than allowed, which is exactly the purpose of this test. However, these specifics may not be immediately apparent when examining the test. Therefore, I agree that it would be more sensible to set the message size to a higher value to prevent any potential confusion. Going to update it.
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.
Please see d71e935
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.
👍
Closes #1111