-1

mysqld.bin and php-fpm are eating up all my CPU.

Here is the output of top run 10 times: https://gist.github.com/two7sclash/5081188dd00e8fc6bfcb

I've got plenty of memory and CPU for the load (theoretically) so I don't understand what is happening. Got OpCache running and a few gigs of swap space, etc.

Here are my opcache settings: https://wiki.bitnami.com/Components/PHP#How_to_install_OPCache_for_PHP.3f

zend_extension=/opt/bitnami/php/lib/php/extensions/opcache.so
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1

Server specs: AWS C3 Large (c3.large, 3.75 GiB RAM, 7 ECUs ).

Not sure if this is related to problems I was having here: https://community.bitnami.com/t/is-xcache-responsible-for-site-hanging-upon-loading-new-php-files/26355

two7s_clash
  • 215
  • 1
  • 4
  • 14

2 Answers2

2

"I've got plenty of memory and CPU for the load" - clearly you don't.

Either you make your current workload fit into the available resource or you expand the resource to fit the workload.

"Got OpCache running" - tuning PHP is a bit more involved than jus enabling the cache. It's certainly a starting point, but your next step should be to check that you've sized it large enough (unlike APC, opcache does not evict stale or older entries - twhen it's full the whole cache is evicted and progressively repopulated).

Checking you've got a sensible setting for memory_limit is next - both too high and too low will result in extra CPU load.

Next profiling and debugging.

symcbean
  • 21,009
  • 1
  • 31
  • 52
  • 1
    For what it's worth, in APC's default (`apc.ttl=0`), it actually clears the whole cache. – BMDan Nov 21 '14 at 16:57
  • Ok, so I suppose I should say -- there should be a way to fix this so the current workload fits into the available resource. I've also added my OpCache settings if you care to critique. – two7s_clash Nov 21 '14 at 17:25
1

the fine folks at bitnami helped me figure this out: https://community.bitnami.com/t/mysqld-bin-and-php-fpm-eating-up-all-my-cpu-c3-large/27015/4?u=sysadmin

Note you have a lot of PHP-FPM processes that they are consuming resources. You have several options:

Configure WordPress php-fpm processes to start automatically when needed. You can add this option in your php-fpm/pool.conf file:

pm=ondemand

You can also reduce the number of php-fpm processes per application in the following files:

php/etc/common-dynamic.conf

pm=dynamic
pm.max_children=5
pm.start_servers=2
pm.min_spare_servers=1
pm.max_spare_servers=3

php/etc/common-ondemand.conf

pm=ondemand
pm.max_children=5
pm.start_servers=2
pm.min_spare_servers=1
pm.max_spare_servers=3
user9517
  • 115,471
  • 20
  • 215
  • 297
two7s_clash
  • 215
  • 1
  • 4
  • 14