roadrunner icon indicating copy to clipboard operation
roadrunner copied to clipboard

[💡FEATURE REQUEST]: Rate-limit plugin

Open anlamas opened this issue 4 years ago • 5 comments

Is your feature request related to a problem? Please describe. A rate limitter for requests. I'm guessing it will be much faster than php middleware.

Describe the solution you'd like If it is possible i'd like to pass number of limit from the framework side(spiral), eg number of limit for specific user stored in database. If not, a simple limitter is still a nice-to-have thing.

Describe alternatives you've considered As alternative i've considered using php middlewares.

Additional context No context

anlamas avatar Feb 23 '21 16:02 anlamas

Ideal scenario:

  1. Global rate limit would work natively on RR side
  2. Scoped rate limit could also work natively on RR side according to some matching rules (e.g certain headers)
  3. Custom rate limit that can call RR RPC from PHP (e.g calculate attributes for matching and then call RR for verdict)

rauanmayemir avatar Aug 06 '24 17:08 rauanmayemir

We already have a community supported rate-limiter (aka circuit breaker): https://docs.roadrunner.dev/docs/community-plugins/circuit-breaker

It does not included in the RR bundle, but can be compiled with Velox. If someone want to take on supporting it, feel free to DM on Discord or here, I'll update permissions for the repository.

rustatian avatar Aug 06 '24 18:08 rustatian

It’s not a rate limiter though. Like, totally different use case.

rauanmayemir avatar Aug 07 '24 04:08 rauanmayemir

Yeah, it's not a rate-limiter. The point is, that such a small middleware is up to the community to build. So, if someone willing to build and support such a middleware, I would be glad to add it to the community plugins docs.

rustatian avatar Aug 07 '24 06:08 rustatian

Understood, it makes sense. 👍 I just assumed that if a FR is not closed as 'wont-fix', then it's not unplanned. 😄

rauanmayemir avatar Aug 07 '24 06:08 rauanmayemir