CPU Issues when minify enabled


#1

Hi, I am using your setup with Zend and Memcached. It runs excellent on my 3 site multisite install.
Something strange is going on when I enable W3TC minify however. The system instantly bogs down and the CPU usage goes through the roof. I have tried this on several instance sizes (AWS) and it easily overwhelms the system. I am using default minify settings and type is Disk.
Can you shed any light on this? I cannot find an explanation.

thanks
cf


#2

@carefreeams,
Can you please send following command output:

  
nproc  
free -m  
nginx -V  
php -v  

and also when the CPU uses to high, please also send the output of following command:

  
ps aux  

#3

ubuntu@ip-0:~$ nproc
1

ubuntu@ip-0:~$ free -m
total used free shared buffers cached
Mem: 992 869 123 78 62 379
-/+ buffers/cache: 427 564
Swap: 255 46 209

ubuntu@ip-0:~$ nginx -V
nginx version: nginx/1.6.0
TLS SNI support enabled
configure arguments: --with-cc-opt=’-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -D_FORTIFY_SOURCE=2’ --with-ld-opt=’-Wl,-Bsymbolic-functions -Wl,-z,relro’ --prefix=/usr/share/nginx --conf-path=/etc/nginx/nginx.conf --http-log-path=/var/log/nginx/access.log --error-log-path=/var/log/nginx/error.log --lock-path=/var/lock/nginx.lock --pid-path=/run/nginx.pid --http-client-body-temp-path=/var/lib/nginx/body --http-fastcgi-temp-path=/var/lib/nginx/fastcgi --http-proxy-temp-path=/var/lib/nginx/proxy --http-scgi-temp-path=/var/lib/nginx/scgi --http-uwsgi-temp-path=/var/lib/nginx/uwsgi --with-debug --with-pcre-jit --with-ipv6 --with-http_ssl_module --with-http_stub_status_module --with-http_realip_module --with-http_auth_request_module --with-http_addition_module --with-http_dav_module --with-http_geoip_module --with-http_gzip_static_module --with-http_image_filter_module --with-http_spdy_module --with-http_sub_module --with-http_xslt_module --with-mail --with-mail_ssl_module --add-module=/build/buildd/nginx-1.6.0/debian/modules/nginx-auth-pam --add-module=/build/buildd/nginx-1.6.0/debian/modules/nginx-dav-ext-module --add-module=/build/buildd/nginx-1.6.0/debian/modules/nginx-echo --add-module=/build/buildd/nginx-1.6.0/debian/modules/nginx-upstream-fair --add-module=/build/buildd/nginx-1.6.0/debian/modules/ngx_http_substitutions_filter_module

ubuntu@ip-0:~$ php -v
PHP 5.5.14-2+deb.sury.org~trusty+1 (cli) (built: Jul 2 2014 12:14:44)
Copyright © 1997-2014 The PHP Group
Zend Engine v2.5.0, Copyright © 1998-2014 Zend Technologies
with Zend OPcache v7.0.4-dev, Copyright © 1999-2014, by Zend Technologies

ubuntu@ip-0:~$ ps -aux
USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
root 1 0.0 0.6 36816 6104 ? Ss Jul07 0:01 /sbin/init
root 2 0.0 0.0 0 0 ? S Jul07 0:00 [kthreadd]
root 3 0.0 0.0 0 0 ? S Jul07 0:00 [ksoftirqd/0]
root 5 0.0 0.0 0 0 ? S< Jul07 0:00 [kworker/0:0H]
root 7 0.0 0.0 0 0 ? S Jul07 0:07 [rcu_sched]
root 8 0.0 0.0 0 0 ? S Jul07 0:22 [rcuos/0]
root 9 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/1]
root 10 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/2]
root 11 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/3]
root 12 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/4]
root 13 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/5]
root 14 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/6]
root 15 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/7]
root 16 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/8]
root 17 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/9]
root 18 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/10]
root 19 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/11]
root 20 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/12]
root 21 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/13]
root 22 0.0 0.0 0 0 ? S Jul07 0:00 [rcuos/14]
root 23 0.0 0.0 0 0 ? S Jul07 0:00 [rcu_bh]
root 24 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/0]
root 25 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/1]
root 26 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/2]
root 27 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/3]
root 28 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/4]
root 29 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/5]
root 30 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/6]
root 31 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/7]
root 32 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/8]
root 33 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/9]
root 34 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/10]
root 35 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/11]
root 36 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/12]
root 37 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/13]
root 38 0.0 0.0 0 0 ? S Jul07 0:00 [rcuob/14]
root 39 0.0 0.0 0 0 ? S Jul07 0:00 [migration/0]
root 40 0.0 0.0 0 0 ? S Jul07 0:04 [watchdog/0]
root 41 0.0 0.0 0 0 ? S< Jul07 0:00 [khelper]
root 42 0.0 0.0 0 0 ? S Jul07 0:00 [kdevtmpfs]
root 43 0.0 0.0 0 0 ? S< Jul07 0:00 [netns]
root 44 0.0 0.0 0 0 ? S Jul07 0:00 [xenwatch]
root 45 0.0 0.0 0 0 ? S Jul07 0:00 [xenbus]
root 46 0.0 0.0 0 0 ? R Jul07 0:06 [kworker/0:1]
root 47 0.0 0.0 0 0 ? S< Jul07 0:00 [writeback]
root 48 0.0 0.0 0 0 ? S< Jul07 0:00 [kintegrityd]
root 49 0.0 0.0 0 0 ? S< Jul07 0:00 [bioset]
root 50 0.0 0.0 0 0 ? S< Jul07 0:00 [kworker/u31:0]
root 51 0.0 0.0 0 0 ? S< Jul07 0:00 [kblockd]
root 52 0.0 0.0 0 0 ? S< Jul07 0:00 [ata_sff]
root 53 0.0 0.0 0 0 ? S Jul07 0:00 [khubd]
root 54 0.0 0.0 0 0 ? S< Jul07 0:00 [md]
root 55 0.0 0.0 0 0 ? S< Jul07 0:00 [devfreq_wq]
root 57 0.0 0.0 0 0 ? S Jul07 0:00 [khungtaskd]
root 58 0.0 0.0 0 0 ? S Jul07 0:00 [kswapd0]
root 59 0.0 0.0 0 0 ? SN Jul07 0:00 [ksmd]
root 60 0.0 0.0 0 0 ? SN Jul07 0:05 [khugepaged]
root 61 0.0 0.0 0 0 ? S Jul07 0:00 [fsnotify_mark]
root 62 0.0 0.0 0 0 ? S Jul07 0:00 [ecryptfs-kthrea]
root 63 0.0 0.0 0 0 ? S< Jul07 0:00 [crypto]
root 75 0.0 0.0 0 0 ? S< Jul07 0:00 [kthrotld]
root 76 0.0 0.0 0 0 ? S Jul07 0:04 [kworker/u30:1]
root 77 0.0 0.0 0 0 ? S Jul07 0:00 [khvcd]
root 78 0.0 0.0 0 0 ? S Jul07 0:00 [scsi_eh_0]
root 79 0.0 0.0 0 0 ? S Jul07 0:00 [scsi_eh_1]
root 100 0.0 0.0 0 0 ? S< Jul07 0:00 [deferwq]
root 101 0.0 0.0 0 0 ? S< Jul07 0:00 [charger_manager]
root 142 0.0 0.0 0 0 ? S< Jul07 0:00 [kpsmoused]
root 164 0.0 0.0 0 0 ? S Jul07 0:00 [kworker/0:2]
root 207 0.0 0.0 0 0 ? S Jul07 0:08 [jbd2/xvda1-8]
root 208 0.0 0.0 0 0 ? S< Jul07 0:00 [ext4-rsv-conver]
root 363 0.0 0.0 49580 760 ? Ss Jul07 0:00 /lib/systemd/systemd-udevd --daemon
root 526 0.0 0.0 10224 840 ? Ss Jul07 0:00 dhclient -1 -v -pf /run/dhclient.eth0.pid -lf /var/lib/dhcp/dhclient.eth0.leases eth0
message+ 763 0.0 0.1 39220 1236 ? Ss Jul07 0:00 dbus-daemon --system --fork
root 791 0.0 0.1 43452 1476 ? Ss Jul07 0:00 /lib/systemd/systemd-logind
syslog 799 0.0 0.5 260076 5712 ? Ssl Jul07 0:00 rsyslogd
root 890 0.0 0.0 14540 744 tty4 Ss+ Jul07 0:00 /sbin/getty -8 38400 tty4
root 893 0.0 0.0 14540 744 tty5 Ss+ Jul07 0:00 /sbin/getty -8 38400 tty5
root 903 0.0 0.0 14540 744 tty2 Ss+ Jul07 0:00 /sbin/getty -8 38400 tty2
root 904 0.0 0.0 14540 744 tty3 Ss+ Jul07 0:00 /sbin/getty -8 38400 tty3
root 907 0.0 0.0 14540 744 tty6 Ss+ Jul07 0:00 /sbin/getty -8 38400 tty6
root 947 0.0 0.2 61364 2124 ? Ss Jul07 0:00 /usr/sbin/sshd -D
root 948 0.0 0.0 4368 432 ? Ss Jul07 0:00 acpid -c /etc/acpi/events -s /var/run/acpid.socket
root 951 0.0 0.0 23656 804 ? Ss Jul07 0:00 cron
daemon 952 0.0 0.0 19140 16 ? Ss Jul07 0:00 atd
memcache 993 0.0 2.5 354916 26168 ? Sl Jul07 1:06 /usr/bin/memcached -m 1024 -p 11211 -u memcache -l 127.0.0.1
root 1044 0.0 1.0 412888 10468 ? Ss Jul07 0:12 php-fpm: master process (/etc/php5/fpm/php-fpm.conf)
root 1045 0.0 1.6 108216 17056 ? Ss Jul07 0:00 nginx: master process /usr/sbin/nginx
www-data 1047 0.0 1.8 109044 18412 ? S Jul07 0:22 nginx: worker process
www-data 1048 0.0 1.8 109044 18624 ? S Jul07 0:21 nginx: worker process
www-data 1049 0.0 1.9 110548 20084 ? S Jul07 0:24 nginx: worker process
www-data 1050 0.0 1.8 109216 18612 ? S Jul07 0:20 nginx: worker process
mysql 1089 0.0 9.4 907916 96524 ? Ssl Jul07 5:39 /usr/sbin/mysqld
root 1140 0.0 0.4 126708 4992 ? Ss Jul07 0:08 /usr/sbin/varnishd -P /var/run/varnishd.pid -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish
nobody 1155 0.0 13.9 4288152 142024 ? Sl Jul07 5:40 /usr/sbin/varnishd -P /var/run/varnishd.pid -a :80 -T localhost:6082 -f /etc/varnish/default.vcl -S /etc/varnish
root 1236 0.0 0.0 100692 960 ? Ss Jul07 0:16 sendmail: MTA: rejecting connections on daemon MSP-v4: load average: 12
root 1479 0.0 0.0 0 0 ? S Jul07 0:00 [kauditd]
root 1619 0.0 0.0 14540 744 tty1 Ss+ Jul07 0:00 /sbin/getty -8 38400 tty1
root 1620 0.0 0.0 12788 680 ttyS0 Ss+ Jul07 0:00 /sbin/getty -8 38400 ttyS0
root 1846 0.0 0.0 0 0 ? S< Jul07 0:00 [kworker/u31:1]
root 11106 0.0 0.0 19476 636 ? S Jul14 0:00 upstart-udev-bridge --daemon
root 11110 0.0 0.0 15276 612 ? S Jul14 0:00 upstart-file-bridge --daemon
root 11111 0.0 0.0 15260 616 ? S Jul14 0:00 upstart-socket-bridge --daemon
nobody 18093 0.0 0.3 15676 3668 ? S Jul15 0:01 /usr/sbin/tinyproxy
nobody 18094 0.0 0.3 19904 3896 ? S Jul15 0:00 /usr/sbin/tinyproxy
nobody 18095 0.0 0.3 19904 3900 ? S Jul15 0:00 /usr/sbin/tinyproxy
nobody 18096 0.0 0.3 19904 3900 ? S Jul15 0:00 /usr/sbin/tinyproxy
nobody 18097 0.0 0.3 19904 3908 ? S Jul15 0:00 /usr/sbin/tinyproxy
nobody 18098 0.0 0.3 19904 3896 ? S Jul15 0:00 /usr/sbin/tinyproxy
nobody 18099 0.0 0.3 19904 3896 ? S Jul15 0:00 /usr/sbin/tinyproxy
nobody 18100 0.0 0.3 19904 3896 ? S Jul15 0:00 /usr/sbin/tinyproxy
nobody 18101 0.0 0.3 19904 3896 ? S Jul15 0:00 /usr/sbin/tinyproxy
nobody 18102 0.0 0.3 19904 3836 ? S Jul15 0:00 /usr/sbin/tinyproxy
nobody 18103 0.0 0.3 19904 3920 ? S Jul15 0:00 /usr/sbin/tinyproxy
nobody 18368 0.0 0.3 19904 3896 ? S Jul15 0:00 /usr/sbin/tinyproxy
nobody 18393 0.0 0.3 19904 3828 ? S Jul15 0:00 /usr/sbin/tinyproxy
root 21022 0.0 0.0 0 0 ? S Jul15 0:00 [kworker/u30:2]
nobody 26109 0.0 0.3 19904 3904 ? S Jul16 0:00 /usr/sbin/tinyproxy
nobody 26607 0.0 0.3 19904 3900 ? S Jul16 0:00 /usr/sbin/tinyproxy
nobody 26647 0.0 0.3 19904 3892 ? S Jul16 0:00 /usr/sbin/tinyproxy
nobody 26662 0.0 0.3 19904 3888 ? S Jul16 0:00 /usr/sbin/tinyproxy
root 30494 0.0 0.4 105632 4216 ? Ss 15:30 0:00 sshd: ubuntu [priv]
ubuntu 30581 0.0 0.1 105632 1896 ? S 15:30 0:00 sshd: ubuntu@pts/0
ubuntu 30582 0.0 0.3 21188 3612 pts/0 Ss 15:30 0:00 -bash
root 30622 0.0 0.4 105632 4220 ? Ss 15:34 0:00 sshd: ubuntu [priv]
ubuntu 30683 0.0 0.1 105632 1900 ? S 15:34 0:00 sshd: ubuntu@pts/1
ubuntu 30684 0.0 0.3 21188 3612 pts/1 Ss 15:34 0:00 -bash
www-data 30705 2.2 3.9 421892 40404 ? R 15:34 0:05 php-fpm: pool www
www-data 30708 2.2 4.1 423804 42144 ? R 15:34 0:05 php-fpm: pool www
www-data 30711 2.1 4.0 423212 41336 ? R 15:34 0:05 php-fpm: pool www
www-data 30716 2.2 5.1 425720 52156 ? R 15:34 0:05 php-fpm: pool www
www-data 30720 2.1 3.5 422204 36456 ? R 15:34 0:05 php-fpm: pool www
ubuntu 30783 0.1 0.1 23640 1636 pts/1 S+ 15:37 0:00 top
www-data 30787 5.0 3.2 419000 33460 ? R 15:37 0:03 php-fpm: pool www
www-data 30789 4.8 3.4 421052 35188 ? R 15:37 0:02 php-fpm: pool www
www-data 30790 4.7 3.1 417208 31876 ? R 15:37 0:02 php-fpm: pool www
www-data 30791 4.6 3.0 416696 31352 ? R 15:37 0:02 php-fpm: pool www
www-data 30793 4.5 3.2 419004 33288 ? R 15:37 0:02 php-fpm: pool www
www-data 30800 4.4 3.5 421820 36280 ? R 15:37 0:02 php-fpm: pool www
www-data 30818 4.3 3.2 418232 32932 ? R 15:37 0:02 php-fpm: pool www
www-data 30836 4.2 3.0 416956 31448 ? R 15:37 0:02 php-fpm: pool www
www-data 30853 4.2 3.0 416440 31352 ? R 15:37 0:02 php-fpm: pool www
www-data 30867 4.1 3.4 421060 35192 ? R 15:37 0:02 php-fpm: pool www
www-data 30870 4.1 3.3 419264 33912 ? R 15:37 0:02 php-fpm: pool www
www-data 30874 4.0 3.3 419524 34180 ? R 15:37 0:02 php-fpm: pool www
www-data 30878 4.0 3.0 416440 31352 ? R 15:37 0:01 php-fpm: pool www
www-data 30880 4.0 3.2 419000 33460 ? R 15:37 0:01 php-fpm: pool www
www-data 30884 4.0 3.0 416440 31352 ? R 15:37 0:01 php-fpm: pool www
ubuntu 31209 0.0 0.1 17168 1304 pts/0 R+ 15:38 0:00 ps -aux


#4

@carefreeams
It seems that php-fpm pool is eating system memory.To reduce this, edit the pool config files vim /etc/php5/fpm/pool.d/www.conf and set pm = ondemand. Then children will be created only to handle requests. This will mean less memory consumption while no requests are active, although it might also mean more time required to create a child.


#5