Skip to content
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

does not work when parameters are large #50

Open
Jovons opened this issue Apr 15, 2020 · 4 comments
Open

does not work when parameters are large #50

Jovons opened this issue Apr 15, 2020 · 4 comments

Comments

@Jovons
Copy link

Jovons commented Apr 15, 2020

I downloaded the latest version and used it with redis server version 5.0.7, I tested cl.throttle command with both small and large parameters (small capacity + refilling speed, large capacity + refilling speed). The result shows that when capacity and refilling speed are both large, like 6000 at most, and every second 6000 (kind like a tps throttling), it does not work at all. Besides, cl.throttle a 6000 6000 1, gives the third parameter larger than 6000 capacity, very odd.

import redis
import time
client = redis.StrictRedis()

def start_throttle():
    n = 0
    while True:
        n += 1
        result = client.execute_command("cl.throttle", "a", 5, 3, 1)
# in another test, I used 6000, 6000, 1
        print n, result
@StanleyP
Copy link

I observed similar behaviour, e.g.

127.0.0.1:16379> CL.THROTTLE user123 1000 1000 60
1) (integer) 0
2) (integer) 1001
3) (integer) 1000
4) (integer) -1
5) (integer) 0
127.0.0.1:16379> CL.THROTTLE user123 1000 1000 60
1) (integer) 0
2) (integer) 1001
3) (integer) 1000
4) (integer) -1
5) (integer) 0
127.0.0.1:16379> CL.THROTTLE user123 1000 1000 60
1) (integer) 0
2) (integer) 1001
3) (integer) 1000
4) (integer) -1
5) (integer) 0
127.0.0.1:16379> KEYS *
(empty list or set)

No key for entry user123 is created and no counters are updated. Basically this configuration / parameters do not provide any rate limiting / throttling for the resource at all!

Maybe I don't understand the GCRA algorithm, but from my POV this clearly is a very serious bug.

Can please author comment?

Is this project still alive?

@StanleyP
Copy link

Hello @brandur,

could you please clarify semantics of max_burst parameter?
Is this project still active or have you abandoned it?

@apodoAR
Copy link

apodoAR commented Nov 18, 2021

I'm having the same issue. Working with max_burst and count_per_period with numbers like 100 or 300 or 500.
Is it a code problem o an implementation problem? I'm working REDIS on docker.

For instance:
CL.THROTTLE user123 100 100 60

image

I ejecute the same command and the numbers does not change.
No redis key was created.

Please, @brandur can you help?
Thanks in advance.
Adrian.

@StanleyP
Copy link

Depending on used parameters (count, max_burst and period) the algorithm sets the expiration of keys only for fraction of second in some cases.
If you set keyspace notifications you will notice the keys (dis)appearing.
https://redis.io/topics/notifications

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants