-
Notifications
You must be signed in to change notification settings - Fork 474
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
ERL: Use IP address instead of IP:port pair #6176
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6176 +/- ##
==========================================
+ Coverage 51.86% 51.88% +0.02%
==========================================
Files 639 639
Lines 85492 85494 +2
==========================================
+ Hits 44338 44358 +20
+ Misses 38339 38322 -17
+ Partials 2815 2814 -1 ☔ View full report in Codecov by Sentry. 🚨 Try these New Features:
|
// guard clauses, and preventing the ElasticRateLimiter from draining its own sharedCapacity | ||
if !exists || q == erl.sharedCapacity { | ||
return | ||
} | ||
delete(erl.capacityByClient, c) | ||
delete(erl.capacityByClient, addr) |
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.
Let's say you have N conns per IP, ERL sets up the closeReservation(wsPeer) is called by the wsPeer's OnClose() handler for each of N conns (not per IP) so you will end up calling delete multiple times for each conn (not per IP) and also, the capacity that is reserved for this IP (CapacityPerReservation) will be returned N times
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.
actually, since N conns are sharing one erl.capacityByClient[IP] entry, ERL will only call wsPeer.OnClose() when it sees the IP missing from the map. So that means if the first conn goes away, it will return the CapacityPerReservation back and delete itself from the map, even though the other conns are still running.
I think there needs to be an implementation of the ErlClient interface, like a meta-client, that manages setting OnClose() handlers for all the wsPeers sharing the same IP, something like that, and function that takes a wsPeer and looks it up by IP, and returns a IPBasedERLClient impl to pass to ConsumeCapacity(c ErlClient). Then when the IPBasedErlClient notices all the child wsPeers have called OnClose, it calls its own OnClose, which in turns calls ERL.closeReservation()
Summary
Make ERL more strict by distinguishing IP addresses instead of connections.
Test Plan
Cluster performance test results