Home > Backend Development > PHP Tutorial > apache内存储器算法

apache内存储器算法

WBOY
Release: 2016-06-13 12:53:09
Original
1229 people have browsed it

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

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


现在比如有一个a.php

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


打印出来 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请求的数量有关
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template