本文介绍了Prefork MPM配置不在httpd.conf中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的EC2 Micro实例存在内存问题,这导致它终止了我的MySQL进程。

I have a memory problem with my EC2 Micro instance which is causing it to terminate my MySQL process.

我已经阅读了很多有关调整Apache以限制内存消耗的信息,并且希望编辑Prefork MPM设置。抓住的是-当我进入httpd.conf时,我没有提到任何MPM模块。

I've read a lot about tuning Apache to limit the memory consumption and am looking to edit the Prefork MPM settings. Catch is - when I go into httpd.conf, I see no mention of any MPM modules.

我一直在寻找,唯一可以找到的参考文献是在/etc/httpd/conf.modules.d/00-mpm.conf中可以看到应该安装了prefork模块。 (LoadModule mpm_prefork_module模块/mod_mpm_prefork.so)

I've been looking around and the only reference I can find to it is in /etc/httpd/conf.modules.d/00-mpm.conf where I can see that the prefork module is supposed to be loaded. (LoadModule mpm_prefork_module modules/mod_mpm_prefork.so)

当我执行httpd -l时,未列出prefork.c。

When I do httpd -l , prefork.c is NOT listed.

目前,我不确定模块是否已使用apache加载/编译,如果可以,如何配置。感谢任何帮助!

At this point I'm not sure if the module is loaded/compiled with apache, and if it is - how to configure it. Appreciate any help!

推荐答案

您可以检查正在运行的MPM:

You can check which MPM is running:

httpd -M | grep mpm

您会看到类似的内容:

mpm_prefork_module (shared)

所有MPM(prefork,工作者,事件)是从您提到的文件配置的:

All MPM's (prefork, worker, event) are configured from the file you mentioned:

/etc/httpd/conf.modules.d/00-mpm.conf

我相当确定AWS仅使用默认值,因此除了加载模块之外没有任何其他东西。您可以继续添加设置。例如

I am fairly sure AWS just uses the defaults so there is nothing except loading the module. You can go ahead and add your settings. e.g.

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so

StartServers           5
ServerLimit            256
MaxRequestWorkers      256
MaxConnectionsPerChild 0

您可以检查了解更多选项

You can check https://httpd.apache.org/docs/2.4/mod/mpm_common.html for more options.

我也遇到了内存问题,并考虑配置MPM来解决该问题,但是它只能减少问题,而不能完全解决问题。

I too have had memory issues and looked at configuring MPM to fix the problem however it only reduced the issues and didn't fix the problem completely.

我最终使用以下命令来设置环境变量:

I ended up using the below to set an environment variable:

export USE_ZEND_ALLOC=0

此后我没有记忆问题。

这篇关于Prefork MPM配置不在httpd.conf中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-30 10:24