Welcome! Log In Create A New Profile

Advanced

limit_conn is not limiting the number of connections in my use case

June 18, 2016 11:49AM
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;
}
}
Subject Author Posted

limit_conn is not limiting the number of connections in my use case

matt_l June 18, 2016 11:49AM

Re: limit_conn is not limiting the number of connections in my use case

Valentin V. Bartenev June 18, 2016 06:42PM

Re: limit_conn is not limiting the number of connections in my use case

Chuanwen Chen June 23, 2016 03:34AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 312
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