The limit_req_zone configuration in my config is as follow :
limit_req_zone $nginx_version zone=site1:10m rate=1000r/s;
I don't want more than 1000 requests per second from the zone site1. I use this zone in my location as follows :
location /exchange/site1/
{
limit_req zone=site1 nodelay;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE_ADDR $remote_addr;
proxy_set_header Host $http_host;
proxy_set_header Content-Type application/json;
proxy_pass http://lb-server/site1/;
proxy_redirect off;
}
However, when I actually use ngxtop to see how many requests I am getting and passing on, I see that site1 is actually sending approximately 600 requests per second but still approximately half of them are getting dropped in nginx. Is there a problem with my configuration? Should I increase the memory space? I tried with 100m but still saw the same behavior. Is there anything else I'm missing here that could help?
Best Answer
The issue is related to not specifying burst value. Due to this nginx will not allow concurrent requests to go through. So a minimum burst value to handle this must be specified.