2

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?

1 Answer 1

2

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.

6
  • I have included this zone in a particular location. So as per my understanding, only this location should get limited. Is that wrong?
    – ZeroG
    May 23, 2017 at 10:38
  • Ok then it should fine. I have a feeling this has nothing to do with limit_req_zone, try removing the limit_req zone from the location. May 23, 2017 at 11:04
  • When I remove limit_req_zone from the location, all the requests are getting passed on to the given location. ngxtop shows 2xx for all requests. With the zone though, requests are getting filtered and ngxtop shows 5xx for approximately half the requests. I have tried various approaches but nothing seems to be helping. Is there any other information you require?
    – ZeroG
    May 23, 2017 at 11:19
  • OK , I researched more ..just put in a burst of around 100 to factor in simultaneous requests stackoverflow.com/questions/26182677/… . Let me know if this work May 23, 2017 at 11:50
  • Thanks. The burst worked well. I added a burst of 500 and almost all the 503's were gone. Thanks a tone. You might want to edit your answer with this and I will accept this answer so that it might help anyone facing this in the future.
    – ZeroG
    May 23, 2017 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .