-
Notifications
You must be signed in to change notification settings - Fork 259
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
v1.18: Connection rate limiting (backport of #948) #1362
Conversation
* use rate limit on connectings use rate limit on connectings; missing file * Change connection rate limit to 8/min instead of 4/s * Addressed some feedback from Trent * removed some comments * fix test failures which are opening connections more frequently * moved the flag up * turn off rate limiting to debug CI * Fix CI test failures * differentiate of the two throttling cases in stats: across connections or per ip addr * fmt issues * Addressed some feedback from Trent * Added unit tests Cleanup connection cache rate limiter if exceeding certain threshold missing files CONNECITON_RATE_LIMITER_CLEANUP_THRESHOLD to 100_000 clippy issue clippy issue sort crates * revert Cargo.lock changes * Addressed some feedback from Pankaj (cherry picked from commit f54c120) # Conflicts: # streamer/src/quic.rs # validator/src/cli.rs
Cherry-pick of f54c120 has failed:
To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## v1.18 #1362 +/- ##
=========================================
- Coverage 81.6% 81.6% -0.1%
=========================================
Files 827 830 +3
Lines 225468 225639 +171
=========================================
+ Hits 184147 184236 +89
- Misses 41321 41403 +82 |
Closing this as stale. If you think this is relevant please re-open and let |
Problem
A client can be abusive and create the connections too fast to over load the server. Even we have per connection limit, it involves more heavy operations like taking lock in the connection table and evicting other connections. Also, a lot of different clients can collectively create too many connections too fast to overwhelm the server. This is observed especially in around the the time when the node becomes a leader.
Summary of Changes
Introduce connection rate limiter.
Limit connection rates from a single IP to 8/minutes
Limit the global connection rate to 2500/second -- 2500 is estimated from the default connection cache table size which is generous.
Fixes #
This is an automatic backport of pull request #948 done by [Mergify](https://mergify.com).