limit_conn is not limiting the number of connections in my use case
matt_l
nginx-forum at forum.nginx.org
Sat Jun 18 15:49:16 UTC 2016
Hello,
I have a hard time understanding limit_conn
My NGINX has the configuration below. I would expect to see 16 connections
on the backend server 192.168.10.131 defined in the "dynamic" directive.
Yet I see ~50-60 connections.
QPS: 3056
Active connections: 58
QPS: 3064
Active connections: 54
QPS: 3063
Active connections: 59
Please note the QPS (Query Per Second) limiting works well.
I would greatly appreciate any tip as to what is going on with my use of the
limit_conn.
Thank you.
upstream locallayer {
server 127.0.0.1:7999;
keepalive 32;
}
server {
listen 8002;
proxy_intercept_errors on;
location / {
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_pass http://locallayer;
}
error_page 302 400 403 404 408 500 502 503 504 = /empty;
location /empty {
return 204;
}
}
upstream dynamic {
least_conn;
server 192.168.10.131:9990;
keepalive 32;
}
limit_conn_zone $binary_remote_addr zone=peripconn:100m;
limit_conn_zone $server_name zone=perserver:10m;
limit_req_zone $binary_remote_addr zone=peripreq:1000m rate=3000r/s;
server {
listen 7999;
server_name local.com;
proxy_intercept_errors on;
location / {
allow 127.0.0.1;
deny all;
limit_conn peripconn 32;
limit_conn perserver 32;
limit_req zone=peripreq burst=100 nodelay;
limit_conn_status 503;
limit_req_status 503;
proxy_http_version 1.1;
proxy_set_header Connection "";
proxy_connect_timeout 10ms;
proxy_send_timeout 10ms;
proxy_read_timeout 60ms;
proxy_pass http://dynamic;
}
error_page 302 400 403 404 408 500 502 503 504 = /empty;
location /empty {
return 204;
}
}
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,267688,267688#msg-267688
More information about the nginx
mailing list