openresty / lua-resty-limit-traffic

Lua library for limiting and controlling traffic in OpenResty/ngx_lua
821 stars 153 forks source link

limit.req with ngx.now #50

Open WANMAX opened 5 years ago

WANMAX commented 5 years ago

My project is online today, the limit config is 1000/s. But the truth is, 300 requests had trigered the req limit(I understand the bucket algorithm). I wonder if this has something to do with the cache of ngx.now.

WANMAX commented 5 years ago

The burst config is 300. I know the diff between the rate and the count of requests, and it is possible that these requests all occur in the 100ms. But there are thirty machines, and the situation lasted about 10 min in every machine every sec. Does it feel right?