Home  >  Article  >  Backend Development  >  apache内存储器算法

apache内存储器算法

WBOY
WBOYOriginal
2016-06-13 12:53:091185browse

apache内存算法
请教一个apache内存的算法
比如在php.ini里设置:

<br />
memory_limit = 512M //最大内存<br />
memory = 16M // 单页面最大内存<br />


现在比如有一个a.php

<?php<br />
include(b.php);// 或者 require(b.php);  b.php为一个空页面<br />
echo (memory_get_usage(true)/1024).'KB';<br />
?>


打印出来 784KB。那么apache真的只消耗了784KB的内存吗?
可实际上,ps -auxf | sort -nr -k 4 | head -10 一个php文件在linux里真的只消耗784KB吗?(返回的值远大于784,是不是memory = 16M,单个httpd就需要消耗16MB?)

另外,include或者require一个文件,是不是相对于消耗掉2个httpd进程?


------解决方案--------------------
是的!
apache(或其他web服务器)只是响应http请求,启动并等待php的完成
apache的内存消耗量至于并发响应http请求的数量有关
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