httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sander Temme <>
Subject Re: [users@httpd] Apache On Multi Core/Multi Processors
Date Thu, 04 Dec 2008 00:26:58 GMT

On Dec 3, 2008, at 3:45 PM, Bruno - e-comBR wrote:

> I want to know how much Apache's HTTPD takes the advantages of
> multiple CPUs. Is there any difference about performance betwen using
> worker or prefork as MPM??

Depends on your operating system architecture.  However, in any  
situation the design of the most popular Apache MPMs has each worker  
handling a particular connection from beginning to end.  This is the  
case whether workers are pre-forked processes, or whether they are  
threads in a child process (worker, Windows MPM).  Effectively this  
means that most of the time, workers are waiting for something to do:  
waiting to read something from the network, for the backend to return  
data, etc.  This means that you usually run many more workers than you  
have CPU cores.

> Being a little "out of topic", let me ask you... On a Linux SMP
> system, does a n Core processor works like n processors?? Is there any
> differences taking performance advantages of multiple CPUs betwen
> using multiple threads or multiple processes??

On Linux specifically, you have two factors at work:

1) Linux process structures are relatively lighweight
2) As far as the Linux kernel is concerned, each thread is mapped onto  
a process structure

The last one means you don't win performance by going to threads  
instead of staying with processes, and the first one means that the  
penalty of context-switching between many processes is smaller on  
Linux than on some other systems (like Solaris).

> Just to make you understand the issue, I'm want to setup a dedicated
> web server with two Quad Core processors, and I can't use worker(which
> is multi-threaded) because I'm using mod_php. So, what I really want
> to know: it's a fact that many CPU's(2 processors x 4 cores = 8) will
> improve the processing performance??

Actually, I believe the core of PHP is now threadsafe and re-entrant.   
However, the PHP group can't make any assumptions or claims about  
threadsafety of the libraries PHP uses, so they won't state PHP runs  
under multithreaded MPMs.  And, because of the circumstances discussed  
above, there is no practical gain from running threads on Linux so PHP  
has little motivation to improve this situation.



Sander Temme
PGP FP: 51B4 8727 466A 0BC3 69F4  B7B8 B2BE BC40 1529 24AF

View raw message