[erlang-questions] Throttling HTTP requests

Karolis Petrauskas k.petrauskas@REDACTED
Fri Sep 21 09:32:33 CEST 2018


I was trying to use https://github.com/uwiger/jobs for rate limiting in my
recent project.
With the spike pattern, this library was not performing. I had to accept
50k requests in ~10-20s, queue them and then handle them at a limited rate
(10tps).
The rate was limited way more, than configured (1tps instead of 10tps, etc).
Then I switched to a custom gen_server with timer:sleep/1 and queue in the
process inbox.

Karolis

On Fri, Sep 21, 2018 at 10:19 AM Roger Lipscombe <roger@REDACTED>
wrote:

> I've not tried, but it looks like you could use
> https://github.com/uwiger/jobs and write some cowboy middleware that
> returns 429.
>
> Or do what we do: since our HTTP-stuff is fronted by nginx (for SSL
> termination and upstream service routing), we used
> https://www.nginx.com/blog/rate-limiting-nginx/
>
> On 21 September 2018 at 07:40, Frank Muller <frank.muller.erl@REDACTED>
> wrote:
>
>> Hi guys
>>
>> We have an HTTP web service based Cowboy which is receiving more and more
>> traffic.
>>
>> We would like to implement a throttling mechanism per IP address to limit
>> how many request/sec the same IP address can make.
>>
>> Is there any library out there for that?
>> Or any (simple yet efficient) algorithm to implement?
>>
>> Ideas & feedabacks are very welcome.
>>
>> Thanks in advance.
>>
>> /Frank
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://erlang.org/mailman/listinfo/erlang-questions
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20180921/bce0d2b2/attachment.htm>


More information about the erlang-questions mailing list