Quantcast
Channel: Nginx Forum - Nginx Mailing List - English
Viewing all articles
Browse latest Browse all 7229

limit_conn is not limiting the number of connections in my use case (1 reply)

$
0
0
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;
}
}

Viewing all articles
Browse latest Browse all 7229


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>