openresty/lua-resty-upstream-healthcheck

many upstream problem

lemon9921010 opened this issue · 7 comments

about 100 upstreams , healthcheck does not work
2 shm zones , 100m dict

@lnsh
Hi, could you post more detail here, such as your lua code, nginx config file and logs. Beside, how to judge it does not work?

[root@nginx01 script]# for uptream in grep upstream /usr/local/openresty/nginx/conf/upstream.conf | awk '{print $2}'; do echo $uptream; done | wc -l
104
local ok, err = hc.spawn_checker{
shm = 'healthcheck', -- defined by 'lua_shared_dict'
upstream = ...
type = 'http',

        http_req = 'GET /status HTTP/1.0\r\nHost: healthcheck.nxin.com\r\n\r\n',
                -- raw HTTP request for checking

        interval = 2000,  -- run the check cycle every 2 sec
        timeout = 1000,   -- 1 sec is the timeout for network operations
        fall = 3,  -- # of successive failures before turning a peer down
        rise = 2,  -- # of successive successes before turning a peer up
        valid_statuses = {200, 302, 301,401,402,403, 404},  -- a list valid HTTP status code
        concurrency = 10,  -- concurrency level for test requests
    }

...
...

       local ok, err = hc.spawn_checker{
        shm = 'healthcheck',  -- defined by 'lua_shared_dict'
        upstream = ...
        type = 'http',

        http_req = 'GET /status HTTP/1.0\r\nHost: healthcheck.nxin.com\r\n\r\n',
                -- raw HTTP request for checking

        interval = 2000,  -- run the check cycle every 2 sec
        timeout = 1000,   -- 1 sec is the timeout for network operations
        fall = 3,  -- # of successive failures before turning a peer down
        rise = 2,  -- # of successive successes before turning a peer up
        valid_statuses = {200, 302, 301,401,402,403, 404},  -- a list valid HTTP status code
        concurrency = 10,  -- concurrency level for test requests
    }

    if not ok then
        ngx.log(ngx.ERR, "failed to spawn health checker: ", err)
        return
    end
}

upstream ,can not get requests
delete about 20 upstreams either from head or tail it works

openresty1.13.6
also update 1.15.8 test, the same problem

@lnsh

Hi, have you get some log in your error log? And could you post them here.

Maybe you can set your lua_max_running_timers and lua_max_pending_timers bigger and try, I think maybe there is some limit in the timer of nginx.

No error log
I try set lua_max_running_timers and lua_max_pending_timers , thx

Unluckily, it does not work too, conf like this
lua_max_pending_timers 2048;
lua_max_running_timers 1024;

log:
init_worker_by_lua error: init_worker_by_lua:1688: main function has more than 200 local variables
delete local it works, 3q