Home  >  Article  >  Backend Development  >  ubuntu php占用大量资源解决方案

ubuntu php占用大量资源解决方案

WBOY
WBOYOriginal
2016-06-13 12:10:08976browse

ubuntu php占用大量资源

------解决思路----------------------
本身就是这样的所以再使用PHP的时候要注意进程占用问题。
------解决思路----------------------
你这个是windows强迫综合症,没有关系的,因为LINUX的内核机制,这些cache起来的内容可以增加文件以及的读写速度。当你的服务器请求空闲时,系统会自动处理的
------解决思路----------------------
nginx 和 php-fpm配置记得调整好

pm.max_children:静态方式下开启的php-fpm进程数量。
pm.start_servers:动态方式下的起始php-fpm进程数量。
pm.min_spare_servers:动态方式下的最小php-fpm进程数量。
pm.max_spare_servers:动态方式下的最大php-fpm进程数量。

memory_limit : 一个进程占用的内存大小

php-fpm最大进程数  =  (你的总内存 - 系统运行需要的内存(估计200M左右)  * 70% (预留30%))  / memory_limit 
------解决思路----------------------
开代码里面是否有逻辑问题,是否循环中使用了很大的数组没释放。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn