A lot of connections

Hi,

We have in our production environment several servers that were once
running tomcat directly on the edge to the web but since then have been
modified so that the tomcat is proxied by nginx.

I have Zabbix set up to monitor ESTABLISHED and TIMEWAIT connections and
plot them in a neat little graph. What I saw when we migrated from the
former configuration to the latter is that the count of connections (of
both states) increased dramatically. By dramatically I mean from
hundreds to thousands and even tens of thousands.

Without understanding too much how nginx handles its connections, it
seems like a complete tomcat request tore down the connections
immediatly while nginx is somehow keeping a lot of them open for longer
than necessary. Maybe it’s by design. Maybe it’s misconfiguration on our
part. Maybe I’m missing something fundamental here.

We are using nginx 0.8.54

and the key config lines are as follows:

worker_processes 8;
events {
worker_connections 2048;
use epoll;
}

server {
listen 80;
server_name localhost;
location / {
root /var/www/html;
index index.html index.htm;
expires max;
}

location /loc1{
client_max_body_size 150m;

            proxy_pass http://localhost:8080;

            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For
            $proxy_add_x_forwarded_for;

            expires 1m;
    }

    location /loc2t {
            client_max_body_size 150m;

            proxy_pass http://localhost:8082;

            proxy_set_header Host $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For
            $proxy_add_x_forwarded_for;

            expires 1m;
    }

Thanks,
DB

Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,186541,186541#msg-186541

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs