openresty / lua-resty-limit-traffic

Lua library for limiting and controlling traffic in OpenResty/ngx_lua
819 stars 150 forks source link

Why the traffic limit requires two limit_req #41

Closed kslr closed 5 years ago

kslr commented 5 years ago
local lim1, err = limit_req.new("my_req_store", 300, 200)
assert(lim1, err)
local lim2, err = limit_req.new("my_req_store", 200, 100)
assert(lim2, err)
local lim3, err = limit_conn.new("my_conn_store", 1000, 1000, 0.5)
assert(lim3, err)

Is it to avoid sudden growth and reduction?

200 ~ 100            300 ~ 200

kslr commented 5 years ago

https://github.com/openresty/lua-resty-limit-traffic/blob/master/lib/resty/limit/traffic.md

local host = ngx.var.host
local client = ngx.var.binary_remote_addr
local keys = {host, client, client}

two client ?