-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
frequency limit on connections #189
Comments
tagging @nivertech |
We implemented this in cowboy_acceptor.erl in nivertech@9e087b8 |
I see some value in adding this. I disagree with the implementation which handles it by closing the newly accepted connection instead of not accepting it in the first place. |
Not accepting new connections even better. On Sun, Apr 8, 2012 at 7:57 PM, Magnus Klaar <
|
When we did rate limiting in etorrent we chose a strategy where we introduce a wait time based on the current rate and the allowed rate. In very vague terms, given a maximum rate of 10000 accepts per second and 100 acceptors and assuming that it takes 0ms to accept and handle a connection. Each acceptor must sleep for 10ms before calling accept/2 again. |
If my async-accept branch goes in (that won't be until after 0.6 though), then it should be much easier to implement this one. |
Yes, since this is one many possible takes on hooking in load regulation at the acceptor level, it's better to make an extension point for this over hard coding in one solution. |
Closing this, to be continued in Ranch: ninenines/ranch#5 |
Cowboy currently features a max connection limit, but it doesn't allow throttling the number of requests per a given time interval. It would be useful to allow specifying two variables
MaxConnPerPeriod
andPeriodInSec
such that more thanMaxConnPerPeriod
perPeriodInSec
is not allowed. Ideally this would be implemented in 2 versions, one in cowboy_listener, and an approximate per listener version to be used if cowboy_listener is disabled (see issue #188).The text was updated successfully, but these errors were encountered: