[CentOS] clustering and load balancing Apache, using nginx

Les Mikesell lesmikesell at gmail.com
Wed Feb 11 17:44:06 UTC 2009


Sergej Kandyla wrote:
> 
> nginx http_proxy module is universal complex solution. Also apache 
> working in prefork mode (in general cases), I don't know does 
> mod_jk\mod_proxy_ajp works in the worker-MPM mode...
> 
> In the preforking mode apache create a child on each incoming request, 
> so it's too much expensive for resource usage.

Have you actually measured this?  Preforking apache doesn't fork per 
request, it forks enough instances to accept the concurrent connection 
count plus a few spares.  Each child would typically handle thousands of 
requests before exiting and requiring a new fork - the number is 
configurable.

> Also apache spend about 
> 15-30Kb mem for serving each tcp connection at this time nginx only 
> 1-1.5Kb. If you have, for example, abount 100 concurrent connections 
> from different IPs there is nearly 100 apache forks... it's too expensive.

A freshly forked child should have nearly 100% memory shared with its 
parent and other child instances.  As things change, this will decrease, 
but you are going to have to store the unique socket/buffer info 
somewhere whether it is a copy-on-write fork or allocated in an 
event-loop program.  If you run something like mod_perl, the shared 
memory effect degrades pretty quickly because of the way perl stores 
reference counts along with its variables, but I'd expect the base 
apache and most module code to be pretty good about retaining their 
inherited shared memory.

> If you don't need full power of apache flexibility as server for dynamic 
> applications, why use it for simple job such as proxing ?
> So, I think nginx is great as light frontend server.

It may be, but I'd like to see some real-world  measurements.  Most of 
the discussions about more efficient approaches seem to use straw-man 
arguments that aren't realistic about the way apache works or timings of 
a few static pages under ideal conditions that don't match an internet 
web server.

-- 
   Les Mikesell
    lesmikesell at gmail.com





More information about the CentOS mailing list