nginx vs apache as a reverse proxy

Cliff Wells cliff at
Tue Mar 3 07:12:14 MSK 2009

On Tue, 2009-03-03 at 14:16 +1100, Linden Varley wrote:
> Sorry I should of mentioned that the requests per second are also
> slightly higher with apache over nginx. Although it’s a marginal
> amount it is consistent.

Then you are probably right that it has to do with no keepalive for
backend connections.

One thing I wonder is if restructuring your stack a bit wouldn't make a
lot of difference.   You say you are serving your static images via
mod_python... what's the logic there?  Are the images dynamically
generated by Django or some other Python web framework?   

> Yes the backend server has a large number of sockets in TIME_WAIT and
> yes keep-alive is on on the backend too. Turning it off does actually
> close the gap which is much better, but are there any plans for the
> proxying in nginx to support keep-alives?

I think it's planned but I unaware of any time-frame.

> It plays havoc with the firewall too since it creates a new state
> entry in the state table for each socket.

Can you eliminate this firewall?  If the Apache server isn't
public-facing, I think I'd just give it a non-routable IP and get rid of
the firewall.


More information about the nginx mailing list