You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When tested against concurrent requests more than 1000, tcp timeout errors occurred, detailed error message,lua tcp socket connect timed out, when connecting to 127.0.0.1:3306.
Personally, I think the multiple connections to mysql and keep-alive setting lead to the problem.
Any solution to fix the problem, like mysql connection pool ,or global mysql instance?
Below is part of the code used in the test.
###################################################
res, err, errcode, sqlstate = db:query("select * from country limit 1")
if not res then
ngx.say("Bad result", err)
return ngx.exit(500)
end
local json = require "cjson"
ngx.say(json.encode(res))
local ok, err = db:set_keepalive(60000, 100)
if not ok then
ngx.say("Failed to set keep alive")
return
end
###################################################
The text was updated successfully, but these errors were encountered:
when query failed, need to close db connection, so you need to do as below: res, err, errcode, sqlstate = db:query("select * from country limit 1") if not res then ngx.say("Bad result", err) db:close() return ngx.exit(500) end
When tested against concurrent requests more than 1000, tcp timeout errors occurred, detailed error message,lua tcp socket connect timed out, when connecting to 127.0.0.1:3306.
Personally, I think the multiple connections to mysql and keep-alive setting lead to the problem.
Any solution to fix the problem, like mysql connection pool ,or global mysql instance?
Below is part of the code used in the test.
###################################################
res, err, errcode, sqlstate = db:query("select * from country limit 1")
if not res then
ngx.say("Bad result", err)
return ngx.exit(500)
end
local json = require "cjson"
ngx.say(json.encode(res))
local ok, err = db:set_keepalive(60000, 100)
if not ok then
ngx.say("Failed to set keep alive")
return
end
###################################################
The text was updated successfully, but these errors were encountered: