We are happy to announce that Vesta is back under active development as of 25 February 2024. We are working on v1 candidate and expect to engage more with the community over the coming months. We are committed to open source, and we encourage contributors to help us build the future of Vesta.
php-cgi eat up the memory
-
- Posts: 10
- Joined: Fri Mar 14, 2014 5:35 am
Re: php-cgi eat up the memory
I think I solved the problem.
I dig many articles and there are some parameter need to add if someone face same problem
Acrossing to the document from apache, http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
PHP_FCGI_CHILDREN should set to 0 due to any child processes created by PHP will not be used effectively. (Additionally, the PHP child processes may not be terminated properly.)
That's why so many php-cgi process was created but not close properly.
The file location is in /home/YOUR_USER/web/YOUR_WEB/cgi-bin/fcgi-starter
Second, edit /etc/httpd/conf.d/fcgid.conf
these parameter should be added after "LoadModule fcgid_module modules/mod_fcgid.so"
REMEMBER BACKUP THE FILE BEFORE YOU EDIT
I dig many articles and there are some parameter need to add if someone face same problem
Acrossing to the document from apache, http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
PHP_FCGI_CHILDREN should set to 0 due to any child processes created by PHP will not be used effectively. (Additionally, the PHP child processes may not be terminated properly.)
That's why so many php-cgi process was created but not close properly.
The file location is in /home/YOUR_USER/web/YOUR_WEB/cgi-bin/fcgi-starter
Second, edit /etc/httpd/conf.d/fcgid.conf
these parameter should be added after "LoadModule fcgid_module modules/mod_fcgid.so"
Code: Select all
FcgidMinProcessesPerClass 0 #no process will be created if the user not active
FcgidMaxProcessesPerClass 16
FcgidMaxProcesses 150
FcgidIdleTimeout 60 #if the process idle 60s will be killed
FcgidProcessLifeTime 120
FcgidIdleScanInterval 30
# Change the rate at which new FastCGI processes are spawned under load. Higher=faster
FcgidSpawnScoreUpLimit 10
# Higher number = spawning more FastCGI processes decreases the spawn rate (controls runaway
FcgidSpawnScore 1
# Higher number = terminating FastCGI processes decreases the spawn rate (controls runaway)
FcgidTerminationScore 2
# Increase the FastCGI max request length for large file uploads (needed for some sites)
FcgidMaxRequestLen 1073741824
FcgidMaxRequestsPerProcess 100000
FcgidIOTimeout 1800
Re: php-cgi eat up the memory
Ok cool
i will test it soon !
But, Imperio, could you confirm the solution proposed by enterpr1se is correct ?
Thx !
i will test it soon !
But, Imperio, could you confirm the solution proposed by enterpr1se is correct ?
Thx !
Re: php-cgi eat up the memory
Hi,
Yes, you can try to use instruction of enterpr1se
if you have any problems let me know
Yes, you can try to use instruction of enterpr1se
if you have any problems let me know
Re: php-cgi eat up the memory
I had the same issue with fastcgid.
As enterpr1se said, the solution is to edit /etc/httpd/conf.d/fcgid.conf (CentOS) or /etc/apache2/mods-available/fcgid.conf (Ubuntu) and will work. I have something like this:
Then restart the apache.
What will this do? Will limit the processses per class to 10 and max 50 processes in total. Every process will automatically kill after 60 seconds (before never killed itself and used most of the ram in idle). Doing this, you will reduce the ram usage with 70%
As enterpr1se said, the solution is to edit /etc/httpd/conf.d/fcgid.conf (CentOS) or /etc/apache2/mods-available/fcgid.conf (Ubuntu) and will work. I have something like this:
Code: Select all
<IfModule mod_fcgid.c>
AddHandler fcgid-script .fcgi
FcgidConnectTimeout 20
FcgidMinProcessesPerClass 0
FcgidMaxProcessesPerClass 10
FcgidMaxProcesses 50
FcgidIdleTimeout 60
FcgidProcessLifeTime 120
FcgidIdleScanInterval 30
# Change the rate at which new FastCGI processes are spawned under load. Higher=faster
FcgidSpawnScoreUpLimit 10
# Higher number = spawning more FastCGI processes decreases the spawn rate (controls runaway
FcgidSpawnScore 2
# Higher number = terminating FastCGI processes decreases the spawn rate (controls runaway)
FcgidTerminationScore 2
# Increase the FastCGI max request length for large file uploads (needed for some sites)
FcgidMaxRequestLen 1073741824
FcgidMaxRequestsPerProcess 100000
FcgidIOTimeout 1800
</IfModule>
What will this do? Will limit the processses per class to 10 and max 50 processes in total. Every process will automatically kill after 60 seconds (before never killed itself and used most of the ram in idle). Doing this, you will reduce the ram usage with 70%
Re: php-cgi eat up the memory
Hi,
Thank you enterpr1se and demlasjr, my problem with RAM and php-cgi seems solved.
Thanks!!
Thank you enterpr1se and demlasjr, my problem with RAM and php-cgi seems solved.
Thanks!!
-
- Posts: 30
- Joined: Sun Nov 23, 2014 4:41 am
Re: php-cgi eat up the memory
Thanks for this solutionenterpr1se wrote:I think I solved the problem.
I dig many articles and there are some parameter need to add if someone face same problem
Acrossing to the document from apache, http://httpd.apache.org/mod_fcgid/mod/mod_fcgid.html
PHP_FCGI_CHILDREN should set to 0 due to any child processes created by PHP will not be used effectively. (Additionally, the PHP child processes may not be terminated properly.)
That's why so many php-cgi process was created but not close properly.
The file location is in /home/YOUR_USER/web/YOUR_WEB/cgi-bin/fcgi-starter
Second, edit /etc/httpd/conf.d/fcgid.conf
these parameter should be added after "LoadModule fcgid_module modules/mod_fcgid.so"
REMEMBER BACKUP THE FILE BEFORE YOU EDITCode: Select all
FcgidMinProcessesPerClass 0 #no process will be created if the user not active FcgidMaxProcessesPerClass 16 FcgidMaxProcesses 150 FcgidIdleTimeout 60 #if the process idle 60s will be killed FcgidProcessLifeTime 120 FcgidIdleScanInterval 30 # Change the rate at which new FastCGI processes are spawned under load. Higher=faster FcgidSpawnScoreUpLimit 10 # Higher number = spawning more FastCGI processes decreases the spawn rate (controls runaway FcgidSpawnScore 1 # Higher number = terminating FastCGI processes decreases the spawn rate (controls runaway) FcgidTerminationScore 2 # Increase the FastCGI max request length for large file uploads (needed for some sites) FcgidMaxRequestLen 1073741824 FcgidMaxRequestsPerProcess 100000 FcgidIOTimeout 1800
-
- Posts: 6
- Joined: Tue Mar 31, 2015 6:37 pm
Re: php-cgi eat up the memory
Ah this is it
Thank you very much
Thank you very much