Welcome! Log In Create A New Profile

Advanced

How to set nginx behavior when critical load is observed

Posted by i.s.ivanov2 
How to set nginx behavior when critical load is observed
July 08, 2010 04:18AM
There is an nginx server with 2 worker_threads and 500 worker_connections.
I use Apache HTTP benchmarking tool (ab) to create >1500 clients that constantly requests cached data from nginx. In parallel I execute some wget-s and browser sessions with the same request.

After some time nginx starts to refuse connections with clients receiving "connection reset by peer".

Question: is there a way to make nginx return correct "503 Unavailable" errors on high load instead of refusing connections?
Re: How to set nginx behavior when critical load is observed
July 14, 2010 05:32AM
Solution is to use HttpLimitZone module (http://wiki.nginx.org/NginxHttpLimitZoneModule) with $host variable.

[code]
http {
limit_zone one $host 10m;
limit_conn one 15;

server {
location /info/ {
limit_conn one 10;
}
location /download/ {
limit_conn one 1;
}
}
}
[/code]
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 305
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready