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

test: measures the max send rate and adds a test to ensure the max rate is observed #1112

Merged
merged 13 commits into from
Oct 23, 2023

Conversation

staheri14
Copy link
Contributor

Part of #1111

@staheri14 staheri14 self-assigned this Oct 11, 2023
@staheri14 staheri14 marked this pull request as ready for review October 11, 2023 18:04
Copy link
Contributor

@cmwaters cmwaters left a comment

Choose a reason for hiding this comment

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

What happens when the flow rate is exceeded i.e. how is rate limiting of messages per peer conducted?

evan-forbes
evan-forbes previously approved these changes Oct 13, 2023
Copy link
Member

@evan-forbes evan-forbes left a comment

Choose a reason for hiding this comment

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

nice

p2p/conn/connection_test.go Show resolved Hide resolved
@staheri14
Copy link
Contributor Author

What happens when the flow rate is exceeded i.e. how is rate limiting of messages per peer conducted?

The expected data transmission rate is enforced by the implementation and should not exceed it. At a high level, the amount of data that can be sent every 100 ms (referred to as the sample rate) is calculated using a uniform distribution, specifically as SendRate * 0.1. When we wish to send data, we do so in batches of 10, each with a size of 1034 bytes, totalling 10340 bytes. However, before sending this data, we check whether we have exceeded the maximum allowed send amount for the current sample period, which is SendRate * 0.1. If we have not exceeded this limit, the batch is sent. If we have exceeded it, the sending procedure is blocked until the current sample period concludes, and a new sample period begins. I have provided code references in the original issue i.e., #1111 (comment)

@cmwaters
Copy link
Contributor

Thanks for the context. So to summarise we block but don't drop the messages?

@staheri14
Copy link
Contributor Author

Thanks for the context. So to summarise we block but don't drop the messages?

Correct.

@staheri14 staheri14 merged commit 7f2a4ad into main Oct 23, 2023
16 checks passed
@staheri14 staheri14 deleted the sanaz/expected-max-send-rate branch October 23, 2023 21:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants