查看php-fpm进程:ps aux | grep php-fpm
或者TOP查看全部进程:
- top - 20:34:31 up 17 days, 3:30, 1 user, load average: 0.01, 0.01, 0.00
- <b><font color="#ff0000">Tasks: 56 total</font></b>, 1 running, 55 sleeping, 0 stopped, 0 zombie
- Cpu(s): 0.3%us, 0.0%sy, 0.0%ni, 99.7%id, 0.0%wa, 0.0%hi, 0.0%si, 0.0%st
- Mem: 131072k total, 97076k used, 33996k free, 0k buffers
- Swap: 131072k total, 51800k used, 79272k free, 14780k cached
- Unknown command - try 'h' for help
- PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
- 21276 www 20 0 32436 9188 3168 S 0.3 7.0 0:00.02 php-fpm
- 1 root 20 0 3356 728 468 S 0.0 0.6 0:04.04 init
- 2 root 20 0 0 0 0 S 0.0 0.0 0:00.00 kthreadd/10003
- 3 root 20 0 0 0 0 S 0.0 0.0 0:00.00 khelper/10003
- 223 root 20 0 2788 292 288 S 0.0 0.2 0:00.00 upstart-udev-br
- 244 root 20 0 2796 184 180 S 0.0 0.1 0:00.00 udevd
- 280 root 20 0 2792 180 176 S 0.0 0.1 0:00.00 udevd
- 281 root 20 0 2792 180 176 S 0.0 0.1 0:00.00 udevd
- 325 root 20 0 2800 216 212 S 0.0 0.2 0:00.00 upstart-socket-
- 544 root 20 0 2572 332 264 S 0.0 0.3 0:01.41 cron
- 545 root 20 0 2516 216 212 S 0.0 0.2 0:00.00 xinetd
- 580 syslog 20 0 2356 436 364 S 0.0 0.3 0:18.73 syslogd
- 598 bind 20 0 49712 424 420 S 0.0 0.3 0:00.44 named
- 607 root 20 0 77176 1232 384 S 0.0 0.9 0:49.43 memcached
- 910 root 20 0 18112 320 272 S 0.0 0.2 0:27.99 php5-fpm
- 913 www-data 20 0 18112 208 204 S 0.0 0.2 0:00.00 php5-fpm
- 914 www-data 20 0 18112 208 204 S 0.0 0.2 0:00.00 php5-fpm
- 915 www-data 20 0 18112 208 204 S 0.0 0.2 0:00.00 php5-fpm
- 916 www-data 20 0 18112 208 204 S 0.0 0.2 0:00.00 php5-fpm
- 942 root 20 0 12944 156 152 S 0.0 0.1 0:00.00 saslauthd
- 944 root 20 0 12944 36 32 S 0.0 0.0 0:00.00 saslauthd
- 990 root 20 0 15096 644 488 S 0.0 0.5 0:25.27 sendmail-mta
- 11483 root 20 0 6636 1100 992 S 0.0 0.8 0:00.35 sshd
- 17262 root 20 0 9564 1216 1100 S 0.0 0.9 0:00.17 sshd
- 17274 root 20 0 3600 1304 1024 S 0.0 1.0 0:00.02 bash
- 19870 root 20 0 5952 336 248 S 0.0 0.3 0:00.00 nginx
- 19872 www 20 0 17204 1428 944 S 0.0 1.1 0:00.30 nginx
- 19874 root 20 0 28364 2752 1344 S 0.0 2.1 0:00.19 php-fpm
- 19886 root 20 0 2188 392 388 S 0.0 0.3 0:00.00 mysqld_safe
- 20149 mysql 20 0 45876 4452 3140 S 0.0 3.4 0:00.31 mysqld
- 21219 www 20 0 33080 10m 3916 S 0.0 8.5 0:00.13 php-fpm
- 21220 www 20 0 30348 8428 3872 S 0.0 6.4 0:00.09 php-fpm
- 21222 www 20 0 32328 10m 4112 S 0.0 8.0 0:00.13 php-fpm
- 21223 www 20 0 30596 8776 3956 S 0.0 6.7 0:00.12 php-fpm
- 21224 www 20 0 32596 10m 4136 S 0.0 8.4 0:00.12 php-fpm
- 21225 www 20 0 28656 4420 2468 S 0.0 3.4 0:00.00 php-fpm
- 21244 www 20 0 28660 4416 2468 S 0.0 3.4 0:00.00 php-fpm
- 21246 www 20 0 28916 5504 3148 S 0.0 4.2 0:00.01 php-fpm
复制代码 目前就128M的VPS而言,进程大约50多个,访问速度正常。
不正常的修改办法:
# vi /usr/local/php/etc/php-fpm.conf
优化pm.的配置:
pm.max_children = 150 #最大进程数
- # cat /usr/local/php/etc/php-fpm.conf
- [global]
- pid = /usr/local/php/var/run/php-fpm.pid
- error_log = /usr/local/php/var/log/php-fpm.log
- log_level = notice
- [www]
- listen = /tmp/php-cgi.sock
- user = www
- group = www
- pm = dynamic
- pm.max_children = 150
- pm.start_servers = 2
- pm.min_spare_servers = 1
- pm.max_spare_servers = 6
- request_terminate_timeout = 100
复制代码
目前内存占用情况正常。也可以参照这个帖子修改相关参数,http://lustlost.blog.51cto.com/2600869/964845还有一篇参考文章。http://luxiaok.blog.51cto.com/2177896/1095459
|