Need help with Apache MPM

Mr-Pro

Verified User
Joined
Dec 19, 2017
Messages
19
Hello guys , I installed directadmin yesterday and I have a problem with Apache load . Does directadmin use prefork MPM by default ? I would like to change Apache MPM but I have two questions .
1 ) Between worker and event MPM , which one is better ? I heard worker can handle many connections with less resources than prefork .
2 ) Is there any simple way to change prefork to worker ? If possible please explain changing from prefork to worker or event in a simple way for me .
Regards ,
 

ditto

Verified User
Joined
Apr 27, 2009
Messages
2,512
I am not going to try to answer all your questions, but here is some information:

When you use PHP as mod_php with mod_ruid2 or suphp, then DirectAdmin as default give you MPM prefork.

When you use PHP-FPM, then DirectAdmin as default give you MPM event.

After my previous study of this, it seems MPM event is the most modern and best option, I believe it is better then both MPM worker and MPM prefork. However I believe MPM worker is better then MPM prefork.

I don't think DirectAdmin uses MPM worker in any setup, so if you want that, you would have to setup it your self.

When changing to for example PHP-FPM, it is important to run ./build rewrite_confs after recompile of PHP, so that the /etc/httpd/conf files is rewritten with MPM event setup.

You can find all the different settings for MPM event and prefork and worker here: /etc/httpd/conf/extra/httpd-mpm.conf - but I recommend to stick with the event or prefork, depending on what PHP mode you are using.
 
Last edited:

Mr-Pro

Verified User
Joined
Dec 19, 2017
Messages
19
Thank you for your response . So you are saying that between worker and event , event is the better option .
As I understood from you response , DirectAdmin will look at php mode and if PHP-FPM is being used , it will automatically switch the MPM to event . Now my question would be how should I change php mode to PHP-FPM . I'm new to directadmin but I think I should use custombuild for this matter . Is that correct?
And also I would like to use nginx as a reverse proxy in front of apache in near future? Will changing php mode and apache MPM cause any problem for that?
Regards ,
 

wattie

Verified User
Joined
May 31, 2008
Messages
1,039
Location
Bulgaria
Prefork - every new connection forks new Apache process

Worker - new connections are opened mostly in threads, not processes which is much more faster and efficient

Event - same as Worker, but with additional optimization that the "keep alive" requests are hold by a specially dedicated process

Before HTTP2 it was not that much big of a difference. Now with HTTP2 one connection can request multiple files. Therefore one new connection can fork many processes (prefork) or threads (worker/event).

Briefly: EVENT IS THE FUTURE. Use it. There is no big reason to choose anything other than php-fpm.
 
Last edited:
Top