luarx opened a new issue, #12592: URL: https://github.com/apache/apisix/issues/12592
### Current Behavior When we use limit-req plugin with `policy:local` it works as expected. BUT when we configure `policy:redis` or `policy:redis-cluster` the results are totally random and unexpected. ### Expected Behavior I expect that limit-req plugin works in the same way when using `policy:local`, `policy:redis` and `policy:redis-cluster`. ### Error Logs _No response_ ### Steps to Reproduce 1. Run Apisix with the docker image apisix:3.12.0 2. Run 1 redis instance (or a redis cluster) using Helm chart https://artifacthub.io/packages/helm/bitnami/redis or https://artifacthub.io/packages/helm/bitnami/redis-cluster 3. Create a consumer (in this case anonymous but it also fails with authenticated consumers) with limit-req plugin (that uses redis) ``` { "username": "anonymous", "desc": "", "plugins": { "limit-req": { "_meta": { "disable": false }, "allow_degradation": false, "burst": 0, "key": "remote_addr", "key_type": "var", "policy": "redis", "rate": 1, "redis_database": 0, "redis_host": "redis-master.ingress-apisix.svc.cluster.local", "redis_timeout": 1000, "rejected_code": 429, "rejected_msg": "Too many requests in time window" } } } ``` 4. Configure an upstream 5. Configure a route using JWT plugin: ``` { "uris": [ "/test/*" ], "name": "test-service", "desc": "", "plugins": { "jwt-auth": { "anonymous_consumer": "anonymous", "cookie": "jwt", "header": "authorization", "hide_credentials": false, "key_claim_name": "key", "query": "jwt", "store_in_ctx": false }, "use_real_request_uri_unsafe": false } }, "labels": { "managed-by": "apisix-ingress-controller" } } ``` 7. Send requests to the defined route and check how the RPS are not being limited to 1 RPS, so 🔴 8. After checking point 7, change the consumer to use limit-req plugin with policy: local`: ``` { "username": "anonymous", "desc": "", "plugins": { "limit-req": { "_meta": { "disable": false }, "allow_degradation": false, "burst": 0, "key": "remote_addr", "key_type": "var", "policy": "local", "rate": 1, "rejected_code": 429, "rejected_msg": "Too many requests in time window" } } } ``` 9. Send requests to the defined route and check how the RPS are now being limited to 1 RPS, so 🟢 ### Environment - APISIX version (run `apisix version`): apisix:3.12.0 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
