5000 connections to backends in TIME_WAIT state, nginx grows and starts swapping

Stefan Caunter stef at caunter.ca
Tue Nov 30 23:24:20 MSK 2010


nginx version: nginx/0.7.67
TLS SNI support enabled
configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I
/usr/local/include' --with-ld-opt='-L /usr/local/lib'
--sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid
--error-log-path=/var/log/nginx-error.log --user=www --group=www
--with-http_gzip_static_module --with-http_ssl_module

I have two freebsd 8.0 servers using carp, nginx listens on the carp
interface on both for high availability.

What I am seeing is that nginx opens 5,000 connections to the
preferred back end. I have a backup back end declared, but prefer one.
This causes nginx to grow in size, use a lot of swap, and die.

I've mitigated this by setting net.inet.tcp.keepidle=300000 on
freebsd. The connections go away after 5 minutes.

It's a pretty simple nginx.conf I use, and I'm not sure why I'm
getting this behaviour. Should I simply upgrade my nginx to latest?

Thoughts appreciated.


Stefan Caunter
cell: 416 561 4871
Skype: stefan.caunter

More information about the nginx mailing list