nic-6443 opened a new pull request, #13363:
URL: https://github.com/apache/apisix/pull/13363

   The limit-count plugin ships the full Lua script text on every Redis call 
via `red:eval()`. At high RPS this wastes both network bandwidth (~200-500 
bytes per call) and Redis CPU (script parsing on every call).
   
   This PR replaces `eval` with `evalsha` + NOSCRIPT fallback in both the 
standalone Redis and Redis Cluster backends of the limit-count plugin. The 
script SHA1 is computed client-side at module load time, avoiding the need for 
`SCRIPT LOAD` (which doesn't route correctly in Redis Cluster). On NOSCRIPT 
(after Redis restart or hitting a new cluster shard), the code falls back to 
`eval` which implicitly caches the script for subsequent calls.
   
   This mirrors the pattern already used by the `limit-conn` plugin, but 
improves on it by supporting Redis Cluster mode (limit-conn currently disables 
evalsha for cluster).
   
   Changes:
   - `apisix/plugins/limit-count/limit-count-redis.lua`: evalsha + NOSCRIPT 
fallback
   - `apisix/plugins/limit-count/limit-count-redis-cluster.lua`: evalsha + 
NOSCRIPT fallback
   - `t/plugin/limit-count-redis.t`: add test for NOSCRIPT fallback recovery


-- 
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]

Reply via email to