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
ab并发压测下的lock超时 #48
Comments
You can try this. @liangwangkai -- redis_conn.lua local redis_cluster = require("rediscluster") -- other file |
have a error : code : local config = { local RedisClusterCon = redis_cluster:new(config) return RedisClusterCon` error: |
Sorry, it is my problem. The reason can be found in openresty/lua-resty-redis#3 |
|
`-----dev.conf server {
} ---nginx.conf worker_processes 1; events { http {
} |
You can try lua_code_cache off; -> lua_code_cache on; |
oh!the problem is solved after lua_code_cache on. thanks |
Because if lua_code_cache is off, the slot_cache will always miss (rediscluster.lua: 154) and fetch slots from redis for each request, the lock may be timeout in high concurrency (rediscluster.lua: 163). |
@liangwangkai please use English in public channel |
redis连接参数:
idletimeout=1
keepaliveTimeout=60000
keepaliveSize=300
connectionTimout=1000
maxRedirection=5
ab压测:
ab -c 10 -n 50 无报错
ab -c 10 -n 100 产生下面报错:
`2019/08/26 19:16:13 [error] 60698#5338817: *962 [lua] rediscluster.lua:168: init_slots(): failed to acquire the lock in initialization slot cache: timeout, client: 127.0.0.1, server: ***, request: "GET /hehe/init?ok=2222000&version=7.2.0&source=2 HTTP/1.0", host: "localhost:9110"
2019/08/26 19:16:13 [error] 60698#5338817: 963 [lua] rediscluster.lua:168: init_slots(): failed to acquire the lock in initialization slot cache: timeout, client: 127.0.0.1, server:**, request: "GET /hehe/init?ok=2222000&version=7.2.0&source=2 HTTP/1.0", host: "localhost:9110"
2019/08/26 19:16:13 [error] 60698#5338817: 964 [lua] rediscluster.lua:168: init_slots(): failed to acquire the lock in initialization slot cache: timeout, client: 127.0.0.1, server:**, request: "GET /hehe/init?ok=2222000&version=7.2.0&source=2 HTTP/1.0", host: "localhost:9110"`
查找代码,定位到是 line 166 获取lock 超时:
local elapsed, err = lock:lock("redis_cluster_slot_" .. sel f.config.name) if not elapsed then ngx.log(ngx.ERR, "failed to acquire the lock in initial ization slot cache: ", err) return end
大家知道什么原因吗?
The text was updated successfully, but these errors were encountered: