Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm frequently getting 503 Service Unavailable when I have limit_req turned on. On my logs:

[error] 22963#0: *70136 limiting requests, excess: 1.000 by zone "blitz", client: 64.xxx.xxx.xx, server: dat.com, request: "GET /id/85 HTTP/1.1", host: "dat.com"

My nginx configuration:

limit_req_zone $binary_remote_addr zone=blitz:60m rate=5r/s;
limit_req   zone=blitz;

How do I resolve this issue. Isn't 60m already big enough? All my static files are hosted on a amazon s3.

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

503 Service unavailable is returned whenever you hit the limit requests. From the limitreq documentation:

If the rate of requests exceeds the rate configured for a zone, request processing is delayed such as that they are processed at a defined rate. Excessive requests are delayed until their number exceeds the defined number of bursts. When exceeded, the request is terminated with an error 503 (Service Temporarily Unavailable). By default, the number of bursts is equal to zero.

You did not specify a burst rate, so whenevery you do more than 5 requests per second, you will get HTTP 503 Service Unavailable in return. Try raising your limit or specify a higher burst rate.

share|improve this answer
    
what's the optimal one? Homw come it says excess: 1.000 by zone etc.. Other values are .945 .25 and something like that. –  Pineapple Under the Sea Sep 8 '12 at 8:50
    
The settings depend on your application and your work load. I think the numbers are the number of requests over the defined limits. For a better technical explanation, I suggest to check the [nginx mailing list] (mailman.nginx.org/pipermail/nginx) –  j0nes Sep 8 '12 at 9:31
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.