简体   繁体   English

Apache Child进程消耗大量内存

[英]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.

相关问题 Apache子进程退出,状态为255 - Apache child process exited with status 255 pcntl_fork 子进程 memory - pcntl_fork child process memory Apache错误AH02538:Child:父进程突然退出。 子进程正在结束xampp PHP 7 - Apache Error AH02538: Child: Parent process exited abruptly. Child process is ending xampp PHP 7 Apache 错误 [notice] Parent: child process exited with status 3221225477 -- Restarting - Apache error [notice] Parent: child process exited with status 3221225477 -- Restarting 如何找到大量Apache / PHP常驻内存使用情况的罪魁祸首模块或脚本? - How to find the culprit module or script on huge Apache/PHP resident memory usage? APACHE崩溃:父:子进程退出,状态为3221225477 —重新启动 - APACHE Crashing: Parent: child process exited with status 3221225477 — Restarting 臭名昭着的Apache错误“父:子进程退出状态为3221225477” - The infamous Apache error “Parent: child process exited with status 3221225477” php / apache asp.net/iis的内存使用情况(进程模型)? - php/apache asp.net/iis memory usage (process models)? 如果过度使用内存,内核将杀死哪个进程? 孩子还是父母? - Which process will be killed by kernel in case of memory over use? child or parent? 用PHP处理一个巨大的Excel文件 - process a huge excel file with php
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM