Hi,
I'm currently working on an openresty based loadbalancer with redis as dynamic backend, and I noticed some performances issues when comparing to our static nginx based current solution.
I stripped down most of of the openresty configuration in order to isolate the part causing most of latency variations.
The performance issue seems to be related to the balancer by lua bloc.
When I replace in my legacy nginx static config :
upstream upstream-server-group {
server :443;
keepalive 64;
}
with :
upstream upstream-server-group {
server 127.0.0.1;
balancer_by_lua_block
{
local balancer = require "ngx.balancer"
local ok, err = balancer.set_current_peer("", 443)
if not ok then
ngx.log(ngx.ERR, "failed to set the current peer: ", err)
return ngx.exit(500)
end
}
keepalive 64;
}
the results of my tests goes from :
Latencies [mean, 50, 95, 99, max] 2.011923ms, 1.972201ms, 2.068322ms, 2.757951ms, 37.345576ms
to
Latencies [mean, 50, 95, 99, max] 3.164499ms, 2.011021ms, 2.171413ms, 43.643579ms, 214.515421ms
Is this a normal behaviour ? is there something special to do to tune balancer_by_lua_block ?
Regards,
Paul