Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


php-cgi high ram usage
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

php-cgi high ram usage

titanicsaledtitanicsaled Member
edited March 2012 in General

Hey,

Would any of you be kind enough to tell me why php-cgi is using so much RAM?

Ive managed to get lighty and mysql sitting at about 60mb ram before but currently its using nearly 128mb ram which is the burstable RAM limit with my BlueVM VPS.

Why are there so many php-cgi processes?

 PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND
    1 root      15   0  2024  724  632 S  0.0  0.6   0:00.48 init
 1308 root      15   0  1944  716  596 S  0.0  0.5   0:00.00 syslogd
 1332 root      18   0  8664  808  472 S  0.0  0.6   0:00.00 saslauthd
 1333 root      18   0  8664  496  160 S  0.0  0.4   0:00.00 saslauthd
 1359 root      18   0  2284  872  692 S  0.0  0.7   0:00.00 cron
 1379 www-data  15   0  5832 1176  572 S  0.0  0.9   0:00.00 lighttpd
 1380 www-data  25   0 30484 5744 3920 S  0.0  4.4   0:00.00 php-cgi
 1383 www-data  25   0 30484 2084  260 S  0.0  1.6   0:00.00 php-cgi
 1384 www-data  25   0 30484 2084  260 S  0.0  1.6   0:00.00 php-cgi
 1385 www-data  25   0 30484 2084  260 S  0.0  1.6   0:00.00 php-cgi
 1386 www-data  25   0 30484 2084  260 S  0.0  1.6   0:00.00 php-cgi
 1410 root      25   0  1740  544  452 S  0.0  0.4   0:00.00 mysqld_safe
 1524 mysql     15   0 40176 6964 5008 S  0.0  5.3   0:00.05 mysqld
 1526 root      18   0  1664  568  500 S  0.0  0.4   0:00.00 logger
 1648 root      18   0  9984 1576  524 S  0.0  1.2   0:00.00 sendmail-mta
 1668 root      18   0  2388  904  740 S  0.0  0.7   0:00.00 xinetd
 1674 root      15   0  2396 1156  912 R  0.0  0.9   0:00.12 dropbear

Thanks

Comments

  • The "virt" size is the size of the complete memory footprint, i.e. there are libraries shared between all of those processes. Concern yourself more with the RSS size.

    @titanicsaled said: Why are there so many php-cgi processes?

    This is controlled by your configuration.

  • http://www.linuxatemyram.com/ is directed more towards disk cache issues, but has information on memory usage.

  • Thing is, it's causing my VPS to crash because its going over quota.

    I might just stick kloxo on it, that seems to work better

  • flyfly Member

    yeah i noticed php-cgi is going crazy on my other vps as well. not sure what the deal is.

  • Configure fcgi to use less processes.

  • sleddogsleddog Member
    edited March 2012

    When a process starts it requests a memory allocation. Typically the allocation is 1.5 to 2 times larger than the amount of memory actually used by the process.

    OpenVZ with user_beancounters (so-called 'guaranteed/burst' memory) counts memory allocation again privvmpages (your 'burst' limit).

    Also on OpenVZ, the amount of memory assigned to a PHP opcode cache, like APC, is counted against your privvmpages. So if you're running a default APC install you can kiss 30 MB of your privvmpages goodbye.

    Things you can do:

    • Reduce your PHP opcode cache to the minimum you really need;
    • Reconfigure PHP to run fewer processes;
    • Try using ulimit' to reduce the amount of memory allocation;
    • Upgrade to a VPS with more 'burst' memory;
    • Get a KVM or Xen box (or I suppose, OpenVZ with vSwap) where this isn't an issue.
  • nocomnocom Member

    Try this to list all the processes currently running (with rss size)
    ps aux | more

    your manual is here: http://www.lowendbox.com/blog/yes-you-can-run-18-static-sites-on-a-64mb-link-1-vps/

  • Go to this thread. Is a variation of this question

    http://www.lowendtalk.com/discussion/1921/openvz-ram-questions

Sign In or Register to comment.