ispCP - Board - Support
php5-cgi ram usage 200mb? - Printable Version

+- ispCP - Board - Support (http://www.isp-control.net/forum)
+-- Forum: ispCP Omega Support Area (/forum-30.html)
+--- Forum: Usage (/forum-34.html)
+--- Thread: php5-cgi ram usage 200mb? (/thread-11816.html)



php5-cgi ram usage 200mb? - jaakko - 10-05-2010 09:54 PM

Hi,

I hope this isn't answered somewhere else yet - tried to do a quick search but to no avail.

I have a VMware ESX VM with 768 MB ram. Running ispCP 1.0.5 OMEGA build: 20100331 Codename: Priamos. The server is operating 16 extremely low-traffic domains but I need to scale the system as my client base grows.

Code:
leskinensolutions:~# cat /etc/debian_version
5.0.6

The problem is that php5-cgi processes are consuming close 200mb each, providing apparent problems running this server.

If I use php as apache2 module there are no ram-related problems aside the apparent non-usermode issues.

I've tried prefork and worker mpm modules to no avail.

I'm currently running apache2-mpm-worker.

Code:
leskinensolutions:~# ps aux | grep php5-cgi | wc -l
7
Code:
leskinensolutions:~# ps aux | grep apache2 | wc -l
6

Output of top:

Code:
Tasks:  93 total,   2 running,  91 sleeping,   0 stopped,   0 zombie
Cpu(s):  2.7%us,  0.0%sy,  0.0%ni, 97.3%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:    769332k total,   613852k used,   155480k free,    10944k buffers
Swap:   522072k total,   217120k used,   304952k free,   259288k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
11706 vu2011    20   0  198m  66m  37m S  0.0  8.9   0:02.76 php5-cgi
11528 vu2002    20   0  194m  63m  37m S  0.0  8.4   0:06.46 php5-cgi
7138 amavis    20   0  191m  55m 2772 S  0.0  7.4   0:02.08 amavisd-new
7139 amavis    20   0  191m  54m 2912 S  0.0  7.3   0:02.36 amavisd-new
11512 vu2021    20   0  192m  53m  27m S  0.0  7.1   0:00.96 php5-cgi
7137 amavis    20   0  188m  49m 2744 S  0.0  6.5   0:00.72 amavisd-new
11648 vu2019    20   0  183m  36m  20m S  0.0  4.8   0:00.32 php5-cgi
10072 vu2000    20   0  179m  30m  19m S  0.0  4.0   0:00.66 php5-cgi
10003 root      20   0 62004  14m 2524 S  0.0  1.9   0:00.18 ispcp-apache-lo
10002 root      20   0 61872  14m 2524 S  0.0  1.9   0:00.18 ispcp-apache-lo
7111 clamav    20   0  193m  14m 5348 S  0.0  1.9   0:04.24 clamd
10246 mysql     20   0 47512  11m 5148 S  0.0  1.6   0:00.42 mysqld
10067 vu2020    20   0  170m 8752 5540 S  0.0  1.1   0:00.02 php5-cgi
10009 www-data  20   0  357m 8412 2012 S  0.0  1.1   0:00.02 apache2
8081 root      20   0  138m 7700 3300 S  0.0  1.0   0:00.64 apache2
11764 www-data  20   0  357m 6900 1844 S  0.0  0.9   0:00.00 apache2
18004 clamav    20   0 57108 5796 5640 S  0.0  0.8   0:01.92 freshclam
2691 postgrey  20   0 57100 5360 2620 S  0.0  0.7   0:01.08 postgrey
10005 www-data  20   0  138m 5032  620 S  0.0  0.7   0:00.02 apache2
10004 www-data  20   0  137m 5028  572 S  0.0  0.7   0:00.00 apache2
8744 polw      20   0 46628 5004 1540 S  0.0  0.7   0:02.36 policyd-weight
5140 root      20   0  103m 3404 1808 S  0.0  0.4   5:19.57 fail2ban-server
2687 polw      20   0 46492 2916 1292 S  0.0  0.4   0:00.90 policyd-weight
2688 polw      20   0 46492 2700  968 S  0.0  0.4   0:01.82 policyd-weight
17429 root      20   0 65932 2344 2172 S  0.0  0.3   0:00.08 sshd
30866 bind      20   0  111m 2140 1352 S  0.0  0.3   0:00.59 named
3315 postfix   20   0 38948 2064 1896 S  0.0  0.3   0:00.04 qmgr
2835 root      20   0 36844 1968 1840 S  0.0  0.3   0:00.14 master
8036 postfix   20   0 38900 1968 1820 S  0.0  0.3   0:00.00 pickup
17446 root      20   0 18848 1728 1392 S  0.0  0.2   0:00.22 bash
2507 root      20   0  119m 1604  884 S  0.0  0.2   0:03.78 rsyslogd


Code:
leskinensolutions:~# free -m
             total       used       free     shared    buffers     cached
Mem:           751        599        151          0         10        253
-/+ buffers/cache:        335        415
Swap:          509        212        297

Since there seems to be a lot of ram in cache, is there something to be alarmed of? To me the php5-cgi ~198mb ram usage seems bit odd.

Anything I could do/check to ensure the ram usage is OK?

Thanks!

BR


RE: php5-cgi ram usage 200mb? - bleed - 10-19-2010 05:31 AM

I'm also interested in this. Is there anything that can be done to reduce php5-cgi memory usage? For example THIS doesn't solve anything.
As I'm read in this forum, someone's php5-cgi process use 3 mb each, maybe a little bit more.


RE: php5-cgi ram usage 200mb? - BeNe - 10-19-2010 03:23 PM

Maybe there be be done some tweaks to low the ram. But i´m not sure.
We all play with the best config. And 768 RAM is not that much for an WebServer.

Play with you fcgid and apache config.

Greez BeNe


RE: php5-cgi ram usage 200mb? - jaakko - 10-19-2010 05:02 PM

FYI, Parallels Confixx runs 30+ domains with less than 200 mb ram.

Code:
leskinendesign:~# free -m
             total       used       free     shared    buffers     cached
Mem:          1024        112        911          0          0          0
-/+ buffers/cache:        112        911
Swap:            0          0          0

Code:
top - 10:00:19 up 26 days, 23:04,  1 user,  load average: 0.00, 0.00, 0.00
Tasks:  36 total,   1 running,  35 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.0%us,  0.0%sy,  0.0%ni,100.0%id,  0.0%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   1048576k total,   115324k used,   933252k free,        0k buffers
Swap:        0k total,        0k used,        0k free,        0k cached

  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
7628 mysql     18   0  147m  35m 5756 S    0  3.5   4:09.92 mysqld
9284 root      15   0 37560  32m 2512 S    0  3.2   0:05.13 spamd
9235 root      15   0 32968  29m 2176 S    0  2.9   2:06.06 spamd
9294 root      18   0 32968  28m  548 S    0  2.8   0:02.06 spamd
9831 root      18   0 27048  10m 5484 S    0  1.0   0:23.11 apache2
22194 www-data  15   0 27696  10m 4724 S    0  1.0   0:07.68 apache2
11828 www-data  15   0 27252 8600 3268 S    0  0.8   0:00.03 apache2
32286 www-data  18   0 27188 8548 3212 S    0  0.8   0:00.01 apache2
32284 www-data  18   0 27188 8460 3136 S    0  0.8   0:00.00 apache2
32302 www-data  18   0 27308 6416 1228 S    0  0.6   0:00.00 apache2
6023 root      18   0  107m 3896 2160 S    0  0.4   0:09.34 named
13537 root      16   0  8316 2264 1848 S    0  0.2   0:00.02 sshd
9722 root      15   0  8792 2168 1656 S    0  0.2   4:20.81 dovecot-auth
13622 root      18   0  8068 2128 1032 S    0  0.2   0:46.40 sendmail-mta

I guess I'm going to disable fcgi altogether.


RE: php5-cgi ram usage 200mb? - kilburn - 10-19-2010 06:14 PM

On the one hand, you can take a look at this thread, where I recommend some settings that can lower ram usage by a whole lot.

On the other hand, be warned that mod_php is not supported by ispcp, so if you switch expect things to break, requiring manual mainteinance to keep everything running.