JanLi-air opened a new issue #1111: request help: apisix.plugins.limit-count.limit-count-redis performance downgraded for continuous pressure URL: https://github.com/apache/incubator-apisix/issues/1111 ### Issue description Performance downgraded dramatically when pressure limit-count-redis continuously. The qps is 6000+ and 90% latency is 30+ for 10000 requests. ![image](https://user-images.githubusercontent.com/55779084/74077431-b147b480-4a5a-11ea-99f9-e3283d5eb2d6.png) But it downgraded to 500+ and 400+ for 100000 requests. ![image](https://user-images.githubusercontent.com/55779084/74077459-d76d5480-4a5a-11ea-99bc-3d0a18c350c2.png) For 100000 requests you can see error logs like this: 2020/02/07 15:14:59 [crit] 32437#0: *149168 connect() to 10.112.16.139:6379 failed (99: Cannot assign requested address), client: 127.0.0.1, server: , request: "GET /index.html?jwt=... HTTP/1.0", host: "127.0.0.1:9080" 2020/02/07 15:14:59 [error] 32437#0: *149168 [lua] custom.lua:120: phase_fun(): failed to limit req: cannot assign requested address, client: 127.0.0.1, server: , request: "GET /index.html?jwt=... HTTP/1.0", host: "127.0.0.1:9080" 10.112.16.139 is the ip address of the redis server, it seems all redis connections are busy. But if I try to use the original limit count plugin(with redis policy), the performance looks good with the 100000 requests. The code is like this: `local limit_redis_new = require("apisix.plugins.limit-count.limit-count-redis").new` below parts are in function _M.access(conf, ctx) `local function create_limit_obj(conf) core.log.warn("create new limit-count plugin instance") return limit_redis_new("plugin-"..plugin_name, 100000, 60, conf) end` ` local conf = { redis_host = "10.112.16.139", redis_port = 6379, redis_timeout = 1000, } local lim, err = core.lrucache.plugin_ctx(plugin_name, ctx, create_limit_obj, conf) if not lim then core.log.error("error create limit: ", err) return 500 end local delay, remaining = lim:incoming(accountId, true) if not delay then local err = remaining if err == "rejected" then return 503 end core.log.error("failed to limit req: ", err) return 500 end core.response.set_header("X-RateLimit-Limit", limit, "X-RateLimit-Remaining", remaining)` ### Environment * apisix version (cmd: `apisix version`): 1.0 * OS: Ubuntu 16.04.6 LTS
---------------------------------------------------------------- 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. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services