问题
I have a memory problem with my EC2 Micro instance which is causing it to terminate my MySQL process.
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.
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)
When I do httpd -l , prefork.c is NOT listed.
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!
回答1:
You can check which MPM is running:
httpd -M | grep mpm
You'll see something like:
mpm_prefork_module (shared)
All MPM's (prefork, worker, event) are configured from the file you mentioned:
/etc/httpd/conf.modules.d/00-mpm.conf
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.
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
I had no memory issues since.
来源:https://stackoverflow.com/questions/36664056/prefork-mpm-configuration-not-in-httpd-conf