Skip to content

help request: can i modify the config_etcd.lua's nginx timer? #7867

@Nobilta

Description

@Nobilta

Description

my apisix's etcd cluster have to many watch request(6000 connections per second),so i want to reduce the pressure of etcd cluster.if i can modify the config_etcd.lua's timer of new function timer from 0 to 0.5 or 1 like this?(i have a test,and it can reduce the number of watch useful ,but i don't know if this can due to a unexpected error)or if have better method to reduce watch?

function _M.new(key, opts)

   ...

    if automatic then
        if not key then
            return nil, "missing `key` argument"
        end

        if loaded_configuration[key] then
            local res = loaded_configuration[key]
            loaded_configuration[key] = nil -- tried to load

            log.notice("use loaded configuration ", key)

            local dir_res, headers = res.body, res.headers
            load_full_data(obj, dir_res, headers)
        end

        ngx_timer_at(1, _automatic_fetch, obj)

    else
        local etcd_cli, err = get_etcd()
        if not etcd_cli then
            return nil, "failed to start a etcd instance: " .. err
        end
        obj.etcd_cli = etcd_cli
    end

    if key then
        created_obj[key] = obj
    end

    return obj
end

Environment

  • APISIX version (run apisix version):2.15
  • Operating system (run uname -a):
  • OpenResty / Nginx version (run openresty -V or nginx -V):
  • etcd version, if relevant (run curl http://127.0.0.1:9090/v1/server_info):3.5
  • APISIX Dashboard version, if relevant:
  • Plugin runner version, for issues related to plugin runners:
  • LuaRocks version, for installation issues (run luarocks --version):

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions