Sudden increase in writing connections and apache processes


I’m using nginx as reverse proxy to apache. Apache only serves php
because I had no time to set up fastcgi or php-fpm on this box.

Anyway, today there was sudden increase in nginx writing connections and
increase of apache processes. It already happened to me in past and
cause was the datacenter resolvers (at least switching to google
resolvers fixed it immediately). Today the change of resolvers does not
do anything.

Here are graphs to show the situation:

Anyone experienced something similar? What can be wrong?

Thank you.


Posted at Nginx Forum:,40894,40894#msg-40894

If resolvers are causing this issue for you, you should run your own
local resolvers. Even googles will have issues from time to time.

I’ve dealt with this a few times and wrote up an article in 2007 to
help with this problem:

If you need resolver to your configuration, you can use upstream {…}.
Nginx resolve hostnames from upstreams in config parsing stage.

It is strange, because now when I change resolvers it does not help. The
writing connections are still higher and apache processes as well.
Traffic is as usual. I will try to recompile newer stable build of nginx
today and maybe try to serve the website comletely from nginx.

Posted at Nginx Forum:,40894,41019#msg-41019

Maybe the keepalives are causing the issue. If your keepalive timeout
is too high, connections that could be recycled to other users will
stay taken up, even though they are idle. Try reducing your keepalive
timeout to 1 second.

I updated nginx to latest stable and problem still here. resolvers work
properly but when I try to connect to the website I need to wait 3
seconds to get connected…any further surfing of the web is fast (I use
keepalive). And I cannot find out why this happened. :frowning:

Posted at Nginx Forum:,40894,41318#msg-41318

Here is what I found out: The cause is keepalive on vBulletin (nginx as
proxy for apache) server that is used for authentication from the main
web server I had troubles with. I debuged the application and found out
the 3 second wait at website loading is always equal to keepalive
settings on the vB server. I put 40 as keepalive timeout, then the
website waited 40 seconds to load, etc… therefore I turned off
keepalive on vB server and all loads instantly.

I do not understand this behavior though. :-? I will investigate further
and switch completely to nginx + fastcgiphp or php-fpm.

Posted at Nginx Forum:,40894,41565#msg-41565