Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Fri Apr 03, 2009 3:04 am 
Offline
Senior Member

Joined: Sun Nov 30, 2008 3:40 pm
Posts: 109
Title says it all. The php5 child processes spawned by www-data don't get killed for a long time. They are not "orphan" (i.e they aren't owned by init) so killing them manually might cause some data loss.

I have PHP_FCGI_MAX_CHILDREN = 5 in my config. I've executed
Code:
ab -n 1000 -c 5 [domain]
in another machine while watching "top" on my linode.

Code:
 9828 www-data  20   0  105m  26m  14m S    0  7.7   0:20.02 php5                                                                                            
 9830 www-data  20   0  105m  26m  14m S    0  7.7   0:23.29 php5                                                                                           
 9829 www-data  20   0  105m  26m  14m S    0  7.6   0:39.03 php5                                                                                           
 9638 www-data  20   0  104m  26m  14m S    0  7.6   0:31.26 php5                                                                                           
 9690 www-data  20   0  103m  25m  14m S    0  7.2   0:31.88 php5 

As you can see, all of the children remain at ~7.7% RAM which, to me, is simply a waste of resources.

Is there a way to terminate the children immediately after their work is done?


Top
   
 Post subject:
PostPosted: Fri Apr 03, 2009 3:38 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
The whole point of FastCGI is to keep the PHP processes alive so that you don't need to start a new process when another request comes along. Why would you want to kill them?


Top
   
 Post subject:
PostPosted: Fri Apr 03, 2009 4:16 am 
Offline
Senior Member

Joined: Sun Nov 30, 2008 3:40 pm
Posts: 109
I have several domains hosted on my linode. For the high traffic ones, yes, that is what I want. But for low traffic ones I'd like the children to get destroyed immediately.

I have seperate config files for all domains, so each can have it's own fcgi settings.

So, is there any way to kill them immediately?


Top
   
 Post subject:
PostPosted: Fri Apr 03, 2009 4:44 am 
Offline
Senior Member
User avatar

Joined: Sat Oct 16, 2004 11:13 am
Posts: 176
Why don't you use mod_php5 instead for those websites?


Top
   
 Post subject:
PostPosted: Fri Apr 03, 2009 5:49 am 
Offline
Senior Member

Joined: Sun Nov 30, 2008 3:40 pm
Posts: 109
I guess that's possible, I've never used fcgi and mod_php at the same time. Do they play well together?


Top
   
 Post subject:
PostPosted: Fri Apr 03, 2009 5:53 am 
Offline
Senior Member
User avatar

Joined: Sat Oct 16, 2004 11:13 am
Posts: 176
dcelasun wrote:
I guess that's possible, I've never used fcgi and mod_php at the same time. Do they play well together?


Yes, I've used them together and never had any problems.


Top
   
 Post subject:
PostPosted: Sat Apr 04, 2009 3:07 am 
Offline
Senior Member

Joined: Fri May 02, 2008 8:44 pm
Posts: 1121
Or use plain old CGI for simplicity's sake, if your sites are really low traffic. It works just like FastCGI except that the process(es) will exit after serving each request.


Top
   
 Post subject:
PostPosted: Sat Apr 04, 2009 8:00 am 
Offline
Senior Member

Joined: Wed Jan 21, 2009 7:13 pm
Posts: 126
Location: Portugal
I have been reading some articles about apache2 + fcgid + php5 and there these 2 articles have diferente approaches:

http://2bits.com/articles/apache-fcgid- ... ation.html
http://typo3.org/development/articles/u ... 45a565e1de

I prefer 2bits version but none mention php opcodes like xcache.

Is there any problem using xcache with 2bits version?
I've read that we must be very carefully with fcgid and xcache to avoid ram wasting.

Another question is the configuration for:

ServerLimit
StartServers
MinSpareServers
MaxSpareServers
MaxClients
MaxRequestsPerChild

I'm running a 360 linode. What are your suggestions?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group