Current time: 05-06-2024, 08:47 PM Hello There, Guest! (LoginRegister)


Post Reply 
How to control the MAX thread of PHP-CGI's NO.?
Author Message
kilburn Offline
Development Team
*****
Dev Team

Posts: 2,182
Joined: Feb 2007
Reputation: 34
Post: #2
RE: How to control the MAX thread of PHP-CGI's NO.?
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
#export PHP_FCGI_CHILDREN
#PHP_FCGI_MAX_REQUESTS=500
#export PHP_FCGI_MAX_REQUESTS

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.
- MaxProcessCount: Specifies the maximum total number of php process that will be spawned, considering *all* the available virtual hosts.
- DefaultMaxClassProcessCount: Specifies the maximum number of php processes spawned *for each virtualhost*.
- DefaultMinClassProcessCount: Specifies the minimum number of php processes spawned *for each virtualhost*. Set it to "0" if you have many domains that are almost never accessed.

Hope this helped.
01-25-2010 05:27 PM
Visit this user's website Find all posts by this user Quote this message in a reply
Post Reply 


Messages In This Thread
RE: How to control the MAX thread of PHP-CGI's NO.? - kilburn - 01-25-2010 05:27 PM

Forum Jump:


User(s) browsing this thread: 2 Guest(s)