Change apache MPM prefork to worker on Amazon Linux AMI

amazon ec2apache-2.2mod-wsgi

My project by default is running under Prefork MPM. Rigth now i am having some slowing issues, my web got timeout error. Searching on differents foroums i see that is recomended to use the worker module and i see differents ways to changed it but in the end nothing working with my project.

I run my project under apache2.2 with this script

python manage.py runmodwsgi –setup-only –host=0.0.0.0 –port=8000 –reload-on-changes –server-root=/mod_wsgi/

This script create my apachectl in the folder "mod_wsgi"
Inside the folder i use "./apachectl -V" to see the module that is working in the project and is see this

Server version: Apache/2.2.34 (Unix)
Server built: Nov 1 2017 18:47:16
Server's Module Magic Number: 20051115:43
Server loaded: APR 1.5.1, APR-Util 1.4.1
Compiled using: APR 1.5.1, APR-Util 1.4.1
Architecture: 64-bit
Server MPM: Prefork
threaded: no
forked: yes (variable process count)
Server compiled with….
-D APACHE_MPM_DIR="server/mpm/prefork"
-D APR_HAS_SENDFILE
-D APR_HAS_MMAP

So, to change it from prefork MPM to Worker i tried was uncomment line:
HTTPD=/usr/sbin/httpd.worker
in the file in this path /etc/sysconfig/httpd, then i restart and run it again, but didnt changed it.

Other thing that i saw in the web was change the file /etc/httpd/conf.modules.d/00-mpm.conf but this path doesnt exitst in my instance.

Also i tried to run my initial script with this aditional flag ./configure –with-mpm=worker but seems that is not working.

Aditional, and is a thing that im not complety sure why happend, if i put just "apachectl -V" without "./" i see that the MPM changed to worker but not in my apachectl from my mod_wsgi folder.

Some advice to change the MPM of my project?
Thanks in advance.

Best Answer

‘Restart’ is ambiguous (will likely translate to apachectl graceful or equivalent). When changing MPM be sure to stop then start.

Related Topic