[英]Apache Child process consume huge memory
"top" shows the result of how httpd-Child-process consume the memory. “顶部”显示了httpd-Child-process如何消耗内存的结果。 most Child process uses 400MB. 大多数子进程使用400MB。 I think this is too huge. 我认为这太大了。
Usually, I know Child process consume the memory at most 50MB. 通常,我知道子进程最多消耗50MB的内存。
Do you know any good way to know why the child process uses huge memory? 您知道什么好方法来了解子进程为何使用大量内存吗?
PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
1039 nobody 20 0 32.7g 412m 55m S 0.0 0.3 0:50.76 httpd
10366 nobody 20 0 32.7g 411m 54m S 0.0 0.3 1:11.28 httpd
16115 nobody 20 0 32.7g 410m 53m S 0.0 0.3 0:44.23 httpd
26472 nobody 20 0 32.7g 410m 52m S 0.0 0.3 0:45.95 httpd
・・・・
・・・・
If the child processes are actively running and handling a large script, like a data import or something, then they might be holding a lot of data in memory while they run. 如果子进程正在主动运行并处理大型脚本(例如数据导入等),则子进程在运行时可能会在内存中保存大量数据。 It really depends on how scripts are running. 这实际上取决于脚本的运行方式。
Typically, if Apache is handing off a request to a module like PHP or something (you have php as a tag on this question), it's the responsibility of that scripting engine to enforce some common-sense limits to things like memory usage or time limits to prevent people from creating scripts that try to suck up all the server's resources. 通常,如果Apache将请求转交给类似PHP之类的模块(在此问题上您使用php作为标记),则脚本引擎负责对内存使用或时间限制等方面实施一些常识性限制防止人们创建试图占用服务器所有资源的脚本。
I would suggest trying to trace these child workers back to the specific requests to confirm that they are just out-of-control PHP scripts or something, then search the content of those scripts to see if they try to override any limits (like set_time_limit(0) or ini_set("memory_limit",...)). 我建议尝试将这些子工追溯到特定请求,以确认它们只是失控的PHP脚本之类的东西,然后搜索这些脚本的内容,以查看它们是否尝试覆盖任何限制(例如set_time_limit( 0)或ini_set(“ memory_limit”,...))。 If they do, then you will have to talk to the developer of the scripts to figure out if they're really needed (eg maybe the developer is reading in a huge data file all at once and keeping it in memory instead of reading it in small chunks). 如果是这样,那么您将不得不与脚本的开发人员联系,以确定是否确实需要它们(例如,开发人员可能一次读取一个巨大的数据文件并将其保存在内存中,而不是读取它们)。小块)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.