Page 1 of 2
php-cgi eat up the memory
Posted: Fri Mar 14, 2014 4:13 pm
by enterpr1se
I had transfer from virtualmin to Vesta in these days.
My VPS have 2GB ram
When I was in Virtualmin, I use fastcgi and it only use about 500MB ram
After transftered to Vesta, I use phpfcgid, it opened over 160 php-cgi processes and eat up 2GB ram and then use about 700MB swap files
But it's only 2-3 vistors from Google Analytics Real-Time stats
(My website is just 1 small wordpress blog, about 500 pv per day)
Why Vesta opened so many php-cgi process without any purpose?

Re: php-cgi eat up the memory
Posted: Sun Mar 16, 2014 9:43 am
by VestaLover
I think you can limit the cgi-process can be spawn for each user.
Re: php-cgi eat up the memory
Posted: Sun Mar 16, 2014 12:12 pm
by enterpr1se
I tried config the php-fpm config file to this value
pm = dynamic
pm.max_children = 4
pm.start_servers = 2
pm.min_spare_servers = 1
pm.max_spare_servers = 3
pm.max_requests = 20
but it doesn't help, it still use 2GB ram + 2GB swap
Re: php-cgi eat up the memory
Posted: Mon Mar 17, 2014 3:51 am
by enterpr1se
I just build a new server with CentOS 6.5 x64, and just install Vesta CP, and haven't transfer any website yet
It already used about 1GB memory, the httpd used 4217 mb (527.125MB)
Is it used too much memory? I tried other CP but seems they use much less memory

Re: php-cgi eat up the memory
Posted: Mon Mar 17, 2014 5:42 am
by VestaLover
No, to see the actual memory consumption is by login to SSH and type free -m.
The memory in the picture shows an allocated memory (served) but not actually being used, so you are okay with it.
Re: php-cgi eat up the memory
Posted: Tue Mar 18, 2014 8:31 am
by enterpr1se
Thanks
Is there anyway to let vesta kill the zombin processes?
The php-cgi process should auto close when they finish their job.
Re: php-cgi eat up the memory
Posted: Tue Mar 18, 2014 8:32 am
by imperio
Hi,
enterpr1se, why have you stopped services ? (named exim dovecot)
what happened ?
It already used about 1GB memory, the httpd used 4217 mb (527.125MB)
use the command
to view memory usage
Re: php-cgi eat up the memory
Posted: Wed Mar 19, 2014 4:05 am
by enterpr1se
I close them because there are some unknow pop3 and imap process
so I close it and want to free more memory
I tried cat /proc/meminfo
Here is the result
My VPS only have 1 website right now with 500PV per day, I do not think it should use so much resource.
It often got error 500 right now.
Could I change from php-fastcgi to php-fpm? Will php-fpm has better fcgi handling ?
Re: php-cgi eat up the memory
Posted: Wed Mar 19, 2014 9:27 am
by imperio
your server uses a lot of memory
Try to use the default templates for apache and nginx
Remove please APC
show me result of this command
Re: php-cgi eat up the memory
Posted: Thu Mar 20, 2014 4:27 am
by enterpr1se
I had unloaded php-apc
I tried use default settings before, it will use less memory at beginning, but it will slowly increase the memory usage, after 3-4 days, it will use up 2GB ram + 1GB swap.
I had change the default settings and reboot, after 18hr, it used most memory.
