Coder Social home page Coder Social logo

Comments (7)

marcosbarbero avatar marcosbarbero commented on May 3, 2024

I don't believe that's possible to achieve in the current implementation

from spring-cloud-zuul-ratelimit.

willswl avatar willswl commented on May 3, 2024

I worked around this problem, but seems it's hard to integrate my solution to the current zuul-ratelimit inplementation.

What I did : created a rate limit checker in zuul filter by using "es.moki.ratelimitj", and defined a policy as below:

ratelimit:

    repository: Redis
    policy-list:
      - service-name: service#1 
        limit: 5
        refresh-interval: 1
        sharable: false  # can not be stolen 
      - service-name: service#2
        limit: 6           
        refresh-interval: 1
        sharable: false # can not be stolen 
      - service-name: service#2
        limit: 4
        refresh-interval: 1
        sharable: true # can be stolen

from spring-cloud-zuul-ratelimit.

marcosbarbero avatar marcosbarbero commented on May 3, 2024

How did you do that?
I never used this ratelimitj before

from spring-cloud-zuul-ratelimit.

willswl avatar willswl commented on May 3, 2024

It's totally a new implementation, but I did refer to your solution to define my policy and the limiting process. I would try to implement that by extending zuul-ratelimit after my busy project work finished.

My solution is simple: I leverage ratelimitj as a standalone limiter, and defined all the three limiters with ratelimitj. When a request comes in, firstly I checked the service name, and found the corresponding limiter that is not sharable. if the limiter is full, I will then look for another limiter that is sharable.

from spring-cloud-zuul-ratelimit.

marcosbarbero avatar marcosbarbero commented on May 3, 2024

Now I got it, based on that I'm sure there will be necessary some redesign in the actual implementation.

@lchayoun WDYT about this proposal?

from spring-cloud-zuul-ratelimit.

lchayoun avatar lchayoun commented on May 3, 2024

well, making two policies use the same allocation (limit / quota) should be easy enough by adding a property to the policy name and in the other policies add a property that specify they consume the other policy quota.
But that not exactly what described here.
Making one policy overflow to another one as described will be harder but it also doable.
We can add a property to specify the overflow policy and on failure to consume try to take it from the other policy.

I think this request is a combination of those two capabilities

from spring-cloud-zuul-ratelimit.

dchack avatar dchack commented on May 3, 2024

I think if you overwrite filter(RateLimitPostFilter and
) , and do some thing for your customer implementation will control rate limit dynamically.

from spring-cloud-zuul-ratelimit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.