Re: moving to quad core

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Sep 15, 2009 at 11:35 AM, Rahul S. Johari
<sleepwalker@xxxxxxxxxxxxxxxx> wrote:
>
>> On 9/15/09 10:54 AM, "Andres Gonzalez" <andres@xxxxxxxxxxxxxxx> wrote:
>>
>>>
>> I have an application developed that uses alot of PHP. Currently, it is
>> running on a Ubuntu 8.04 , single core CPU host.  We are moving to a
>> quad core host for this application.
>>
>> Is there anything special that I need to do to configure PHP to run on a
>> quad core host? I noticed that my current single core system has PHP
>> configured with Thread Safety disabled (as reported from phpinfo()).
>> Does that need to be enabled to run in a multi-core environment?
>>
>> Any other suggestions for configuring PHP for multi-core use?
>
>
> Very interesting question indeed;
>
> I moved from a single-core to dual-core some time back, and recently moved
> from dual-core to quad-core. Never paid attention to the hyper-threading
> difference in the httpd process. Would definitely be interesting in seeing
> more information on this topic.
>
> ---
> Rahul Sitaram Johari
> Founder, Internet Architects Group, Inc.
>
> [Email] sleepwalker@xxxxxxxxxxxxxxxx
> [Web]   http://www.rahulsjohari.com
>
>
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>

In regards to thread-safe compilations of PHP, if you don't absolutely
know you need it, you don't need it.

Utilizing a multiple CPU server setup with PHP depends on how you're
using PHP.  If you're using FastCGI with a process pool, the number of
PHP processes is going to determine how many CPUs PHP uses, obviously
enough.  On a quad core machine, 2 FastCGI children in the pool are
only ever going to use 2 cores, while 4 processes has a higher
likelihood of utilizing the entire set of CPUs.  However, setting your
child process number too low can seriously impede your performance, so
there's some experimentation necessary to determine what's best for
your particular scenario, based on usage, server power, script
profiling, etc. but a good number to start with is (1.5 * # of logical
processors).

All of this necessarily changes if you're using Apache, of course.
Under the classic pre-fork model, Apache forks a new process to handle
a request every time the server is hit.  So, to utilize four cores,
Apache would have to serve four pages simultaneously, forking four
child processes.  Depending on your traffic and page generation time,
the amount of child Apache processes can pretty easily head up into
the hundreds, unless of course you have a lower MaxChildren set (which
I personally would recommend against because of Apache's huge glaring
vulnerability to SlowLoris).  Under the worker model, Apache forks up
to X processes, and each process handles a configurable amount of
requests before dying, so like FastCGI, you'd have to configure the
number of children to be run, although it's recommended (I hear, I'm
not too very familiar with Apache) to use a much higher number than
the amount of cores, several dozen perhaps.  Like I said, I'm not too
familiar with Apache, so I'd do some research and experimentation with
the number of child workers to give Apache.

I hope this helps :)

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux