Nebo15 / annon.api

Configurable API gateway that acts as a reverse proxy with a plugin system.
http://docs.annon.apiary.io/
MIT License
332 stars 26 forks source link

RFC: Rate-limiter API #219

Open AndrewDryga opened 7 years ago

AndrewDryga commented 7 years ago

The rate limit plugin requires us to follow one of the options:

First. To store a distributed CRDT counter which is merged via clustering protocol on an event or timing basis.

Pros:

Cons:

--

Second. Build a hash ring out of all known Annon nodes and route counter increment calls or whole request to the node which is responsible for limiting it (probably via RPC calls; Kademilla DHT?).

Pros:

Cons:

--

Third. Provide only very limited rate limiting which would work either with load balancer that supports sticky sessions (route request to the same Annon instance for each consumer) or when there is only one Annon instance at all.

This is similar to option one, except we don't need to sync CRDT's.

--

Fourth. Use persistent backends.

Proc:

Cons:

AndrewDryga commented 7 years ago

Kong is providing QOS levels with different backends for rate limiting - https://getkong.org/plugins/rate-limiting/.

AndrewDryga commented 7 years ago

http://blog.00null.net/post/166149523731/rate-limiting-phoenix-with-redis-too?utm_campaign=elixir_radar_116&utm_medium=email&utm_source=RD+Station

AndrewDryga commented 6 years ago

https://github.com/myntra/golimit/blob/master/README.md