How to control the MAX thread of PHP-CGI's NO.? - Printable Version +- ispCP - Board - Support (http://www.isp-control.net/forum) +-- Forum: ispCP Omega Support Area (/forum-30.html) +--- Forum: System Setup & Installation (/forum-32.html) +--- Thread: How to control the MAX thread of PHP-CGI's NO.? (/thread-9360.html) |
How to control the MAX thread of PHP-CGI's NO.? - jetvster - 01-25-2010 12:53 PM apache2.config Quote:<IfModule mpm_worker_module>php5-fcgi-starter Quote:#!/bin/sh Quote:host:/etc/apache2/mods-enabled# ps aux |grep php |wc -l Quote:host:/etc/apache2/mods-enabled# ps aux |grep apache2 i want to control the max thread of PHP-CGI and apache,i change the param ThreadsPerChild and ServerLimit of apache2.config,but it's seem nouse,any idea? RE: How to control the MAX thread of PHP-CGI's NO.? - kilburn - 01-25-2010 05:27 PM We're missing some info: - OS/Distro/Version? - fcgid/fastcgi/mod_php? - prefork/worker/event? For worker + fcgid, you have to take into account that there are 2 types of processes used: apache *and* php. Both are going to consume memory, and you have to configure both of them. Basically, the number of apache processes is configured by the "MaxClients" and "ThreadsPerChild" directives (see worker docs, summary section). In your case, you've setup these directives 150 and 25 respectively. Thus, apache spawns up to 150/25 = 6 apache worker processes (+ the master, which runs as root). Play with these numbers to get more or less apache workers as you wish. Now, regarding php (fcgid), things are a bit more cumbersome. First, you should comment out the following lines in *all* the /var/www/fcgi/<domain.tld>/php5-fcgi-starter files (you'll have to write a script to do it if you have many domains): Quote:#PHP_FCGI_CHILDREN=2 Next, comment out the same lines in "/etc/ispcp/fcgi/parts/*", so that new domains are configured exactly the same as the ones that you've manually configured. Finally, you can tune up fcgid's parameters by modifying the /etc/apache2/mods-enabled/fcgid_ispcp.conf. The most relevant directives (regarding performance/memory consumption) are: Code: - IdleTimeout: Specifies how many time a process may stay idle before being killed by the process manager. Thus, decreasing it will kill workers faster and you should observe a lower resource usage. Setting it to low is bad though, because it will cause too much re-spawning. Hope this helped. RE: How to control the MAX thread of PHP-CGI's NO.? - Nuxwin - 10-19-2010 06:17 PM @marc, You wrong here! To really disable PHP process manager, you should export PHP_FCGI_CHILDREN like this Code: PHP_FCGI_CHILDREN = 0 Otherwise, will not work. RE: How to control the MAX thread of PHP-CGI's NO.? - kilburn - 10-19-2010 06:26 PM Nuxi, I'm using this config on multiple servers, so I can assure you that it does work. Basically, 0 is the default value for PHP_FCGI_CHILDREN if it's not set, at least in debian stable. RE: How to control the MAX thread of PHP-CGI's NO.? - Nuxwin - 10-19-2010 06:29 PM No, you wrong Edit: Sorry, after check, it seem that was changed (default 8 to default 0)... Since PHP 5.2.0 (I think) For now, under Lenny (php 5.2.6) it's defaulted to 0. http://svn.php.net/viewvc/php/php-src/tags/php_5_2_6/sapi/cgi/README.FastCGI?view=markup http://www.mail-archive.com/php-cvs@lists.php.net/msg24066.html RE: How to control the MAX thread of PHP-CGI's NO.? - avnhenry - 10-27-2010 07:12 PM Lighttpd is known to have memory leakage problems.I had a scenario similar to yours. No matter what I did in the kernel parameters and/or to lightly config file,the crash kept happening randomly.This directive allows you to disable certain functions for security reasons.It takes on a comma-delimited list of function names. disable_functions is not affected by Safe Mode. RE: How to control the MAX thread of PHP-CGI's NO.? - nikolas22t - 03-24-2011 06:17 PM I have a serious problem with server memory on a VM , every few minutes or hours server gives a message "out of memory, killed process php5-cgi" the options below are comment out on each domain , but still have the problem , any other suggestion ? PHP_FCGI_CHILDREN=2 export PHP_FCGI_CHILDREN PHP_FCGI_MAX_REQUESTS=500 export PHP_FCGI_MAX_REQUESTS RE: How to control the MAX thread of PHP-CGI's NO.? - kilburn - 03-24-2011 09:39 PM We need more specific information on your server's resources and how are they being utilized. How much memory does it have? How many apache worker processes is it running? How many php-cgi processes? How much memory is assigned to mysql? etc... |