Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

when using "resty.limit.req" to control rate, actual request processing rate might exceed configured rate. #40

Open
NagamineLee opened this issue Oct 25, 2018 · 5 comments

Comments

@NagamineLee
Copy link

http {
limit_req_zone $uri zone=one:10m rate=1000r/s;
server {
location /limit-req {
access_by_lua_block {
local limit_req = require "resty.limit.req"
local lim, err = limit_req.new("my_limit_req_store", 100, 0)
...
if delay >= 0.001 then
--ngx.sleep(delay)
end
}
...
}
}
}

When using jmeter(threads=400, interval=300s) to simulate the stress test, jmeter test results show that actual request processing rate(hearly 1000r/s) has exceeded configured rate(100r/s).

even though start delay processing, the result is same.

@agentzh
Copy link
Member

agentzh commented Oct 25, 2018

@NagamineLee You should use lua_shared_dict instead of limit_req_zone in your config. They are very different things. Do not mix them and read the docs.

@NagamineLee
Copy link
Author

sorry, this is a mistake. Actually I used lua_shared_dict during testing, but results were also same with above. @agentzh

@xiie
Copy link

xiie commented Jan 5, 2019

sorry, this is a mistake. Actually I used lua_shared_dict during testing, but results were also same with above. @agentzh

I'm in the same boat as you; i test ngx_http_limit_req_module is OK

@agentzh
Copy link
Member

agentzh commented Feb 4, 2019

@NagamineLee Please provide a minimal and self-contained example that we can easily reproduce the problem on our side. We don't want to guess.

@agentzh
Copy link
Member

agentzh commented Feb 4, 2019

@NagamineLee Also detailed steps to reproduce the problem and your actual output in each step would be very useful.

monkeyDluffy6017 pushed a commit to monkeyDluffy6017/lua-resty-limit-traffic that referenced this issue Apr 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants