Req #55166 [Com]: Implement a global limit to the overall number of php processes
Edit report at https://bugs.php.net/bug.php?id=55166&edit=1 ID: 55166 Comment by: trollofdarkness at gmail dot com Reported by:trollofdarkness at gmail dot com Summary:Implement a global limit to the overall number of php processes Status: Closed Type: Feature/Change Request Package:FPM related PHP Version:5.3SVN-2011-07-09 (SVN) Assigned To:fat Block user comment: N Private report: N New Comment: A small note to those ones who will read this entry : When committed into 5.3.4, the directive has been renamed from "max_total_process" to "process.max". I don't know whether it has been added in the documentation yet, I found by digging into the code. Previous Comments: [2011-10-08 19:53:03] f...@php.net This bug has been fixed in SVN. Snapshots of the sources are packaged every three hours; this change will be in the next snapshot. You can grab the snapshot at http://snaps.php.net/. For Windows: http://windows.php.net/snapshots/ Thank you for the report, and for helping us make PHP better. [2011-10-08 13:47:29] f...@php.net Automatic comment from SVN on behalf of fat Revision: http://svn.php.net/viewvc/?view=revision&revision=317896 Log: - Backported FR #55166 from 5.4 branch (Added process.max to control the number of process FPM can fork) [2011-09-27 10:46:22] albertcasademont at gmail dot com This is an amazing feature guys, thank you very much! Any news on backporting the patch to 5.3? Thanks! [2011-07-17 17:22:33] trollofdarkness at gmail dot com Ok :) Thank you for your reactivity ;) [2011-07-17 07:43:22] f...@php.net Commited into 5.4. Thx you very much for your help. I'll wait 5.3.7 is out before backporting this to 5.3 branch. The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=55166 -- Edit this bug report at https://bugs.php.net/bug.php?id=55166&edit=1
Req #55166 [Com]: Implement a global limit to the overall number of php processes
Edit report at https://bugs.php.net/bug.php?id=55166&edit=1 ID: 55166 Comment by: albertcasademont at gmail dot com Reported by:trollofdarkness at gmail dot com Summary:Implement a global limit to the overall number of php processes Status: Analyzed Type: Feature/Change Request Package:FPM related PHP Version:5.3SVN-2011-07-09 (SVN) Assigned To:fat Block user comment: N Private report: N New Comment: This is an amazing feature guys, thank you very much! Any news on backporting the patch to 5.3? Thanks! Previous Comments: [2011-07-17 17:22:33] trollofdarkness at gmail dot com Ok :) Thank you for your reactivity ;) [2011-07-17 07:43:22] f...@php.net Commited into 5.4. Thx you very much for your help. I'll wait 5.3.7 is out before backporting this to 5.3 branch. [2011-07-17 07:41:53] f...@php.net Automatic comment from SVN on behalf of fat Revision: http://svn.php.net/viewvc/?view=revision&revision=313323 Log: - Implemented FR #55166 (Added process.max to control the number of process FPM can fork) [2011-07-09 12:07:18] trollofdarkness at gmail dot com Description: Hi everyone, I post here a patch that adds the ability to php-fpm to globally limit the global number of php processes. I made it for personal purpose as I have an "only" 2GB RAM server and several website running on it. The problem is the following, when you have several pools : * Either you choose to have a max_children which is low, you won't go out of memory, but if there is a peak on a specific website while the other ones are quiet, this specific website will be slow, because there will be a queue for the FastCGI requests * Or you choose to have a max_children which is high and you thus allow peaks on your websites, but if ever there is a peak on several website at the same time, chances are that your server will go out of memory. With this patch, I introduce a new configuration directive : [global] max_total_processes = 40 40 will be the total number of php processes authorized to be launched in memory at the same time. When trying to fork a new process (only in the case on pm = dynamic (or pm = ondemand, by the way)) the FPM will look at the current total number of processes that are launched in memory. This is made easy to integrate because FPM already has a fpm_globals.running_children variable referencing the total number of children, all pools summed up. I just had to add a condition, a variable & the ability to read a new config option. SO this is a really, really small patch ! But very useful I think. The current uploaded patch file has been made for the PHP 5.3 SVN Branch source. Feel free to adapt it to another version of the sources if you want, you will see that it is just a matter of 4-5 changes in the source code. Hope it will be useful. -- Troll -- Edit this bug report at https://bugs.php.net/bug.php?id=55166&edit=1
Req #55166 [Com]: Implement a global limit to the overall number of php processes
Edit report at https://bugs.php.net/bug.php?id=55166&edit=1 ID: 55166 Comment by: trollofdarkness at gmail dot com Reported by:trollofdarkness at gmail dot com Summary:Implement a global limit to the overall number of php processes Status: Analyzed Type: Feature/Change Request Package:FPM related PHP Version:5.3SVN-2011-07-09 (SVN) Assigned To:fat Block user comment: N Private report: N New Comment: Ok :) Thank you for your reactivity ;) Previous Comments: [2011-07-17 07:43:22] f...@php.net Commited into 5.4. Thx you very much for your help. I'll wait 5.3.7 is out before backporting this to 5.3 branch. [2011-07-17 07:41:53] f...@php.net Automatic comment from SVN on behalf of fat Revision: http://svn.php.net/viewvc/?view=revision&revision=313323 Log: - Implemented FR #55166 (Added process.max to control the number of process FPM can fork) [2011-07-09 12:07:18] trollofdarkness at gmail dot com Description: Hi everyone, I post here a patch that adds the ability to php-fpm to globally limit the global number of php processes. I made it for personal purpose as I have an "only" 2GB RAM server and several website running on it. The problem is the following, when you have several pools : * Either you choose to have a max_children which is low, you won't go out of memory, but if there is a peak on a specific website while the other ones are quiet, this specific website will be slow, because there will be a queue for the FastCGI requests * Or you choose to have a max_children which is high and you thus allow peaks on your websites, but if ever there is a peak on several website at the same time, chances are that your server will go out of memory. With this patch, I introduce a new configuration directive : [global] max_total_processes = 40 40 will be the total number of php processes authorized to be launched in memory at the same time. When trying to fork a new process (only in the case on pm = dynamic (or pm = ondemand, by the way)) the FPM will look at the current total number of processes that are launched in memory. This is made easy to integrate because FPM already has a fpm_globals.running_children variable referencing the total number of children, all pools summed up. I just had to add a condition, a variable & the ability to read a new config option. SO this is a really, really small patch ! But very useful I think. The current uploaded patch file has been made for the PHP 5.3 SVN Branch source. Feel free to adapt it to another version of the sources if you want, you will see that it is just a matter of 4-5 changes in the source code. Hope it will be useful. -- Troll -- Edit this bug report at https://bugs.php.net/bug.php?id=55166&edit=1