Prefork vs Event Apache 2.4

MichaelW.

Member
May 31, 2018
24
5
3
Sweden
cPanel Access Level
Root Administrator
Hello!

I want to change the mpm for our WHM servers, from the standard prefork module to event.

Can this be done during operational hours for the servers without any interruptions or problems for our websites?

Reason I want to change is because I think that even though our servers do not have that many websites, they are hogging a lot of memory! So I want to optimize the servers even further with changing the mpm.

Thanks!

EDIT: Also want to add that we do have mod_ruid2 installed, but I am not that certain of what mod_ruid2 actually does. What would happen if you just disable it? Will it have any complications going to event from an environment that has mod_ruid2 enabled?
 
Last edited:

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,295
1,254
313
Houston
Hi @MichaelW.

You may want to read up on the documentation going over the mpms before making the switch
Multi-Processing Modules - MPMs - EasyApache 4 - cPanel Documentation

Though in most cases there is no downtime you may want to ensure you're prepared.

As far as ruid2 we do have some information here:
PHP Handlers - EasyApache 4 - cPanel Documentation

Information on what mod_ruid2 is can best be found here mind04/mod-ruid2 essentially mod_ruid2 changes the permissions of the HTTP requests for a domain to the permissions of the owner of that domain.

If you do not select an Apache module that changes the permissions of Apache requests, your Apache web server will run Apache processes as the nobody user, which presents security risks. The following Apache modules also change the permissions of Apache requests:

  • mpm_itk_module
  • suexec
  • mod_suphp
 
  • Like
Reactions: MichaelW.

MichaelW.

Member
May 31, 2018
24
5
3
Sweden
cPanel Access Level
Root Administrator
Hi @MichaelW.

You may want to read up on the documentation going over the mpms before making the switch
Multi-Processing Modules - MPMs - EasyApache 4 - cPanel Documentation

Though in most cases there is no downtime you may want to ensure you're prepared.

As far as ruid2 we do have some information here:
PHP Handlers - EasyApache 4 - cPanel Documentation

Information on what mod_ruid2 is can best be found here mind04/mod-ruid2 essentially mod_ruid2 changes the permissions of the HTTP requests for a domain to the permissions of the owner of that domain.

If you do not select an Apache module that changes the permissions of Apache requests, your Apache web server will run Apache processes as the nobody user, which presents security risks. The following Apache modules also change the permissions of Apache requests:

  • mpm_itk_module
  • suexec
  • mod_suphp
Hi cPanelLauren!

Thanks for your reply!

I have taken the time to read about it a little bit more.
In our PHP ini files we have the sql.safe_mode off, so I am guessing that worker might actually be a better choice for our environment.
Having threads vs having no threads, and getting more RAM available feels like a good plan.

Also, even though mod_ruid2 is installed, there are still some processes being run with a "nobody" user. How can I prevent this if I change to the worker or event mpm?
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,295
1,254
313
Houston
Also, even though mod_ruid2 is installed, there are still some processes being run with a "nobody" user. How can I prevent this if I change to the worker or event mpm?
You won't stop this altogether, this will just prevent users httpd processes from being created as the nobody user. httpd's own processes are still run under the nobody user my server for example:


You can see I'm running the prefork MPM with ruid2:

Code:
[[email protected] ~]# httpd -M |grep mpm
 mpm_prefork_module (shared)
[[email protected] ~]# rpm -qa |grep ruid2
ea-apache24-mod_ruid2-0.9.8-15.15.27.cpanel.x86_64
And I have multiple proceses run by the nobody user:

Code:
[[email protected] ~]# ps faux |grep nobod[y]
nobody    3936  0.0  0.1 419992  7392 ?        Sl   07:55   0:00  |   \_ Passenger ust-router
nobody    3956  0.0  0.5 297272 21584 ?        S    07:55   0:00  \_ /usr/sbin/httpd -k start
nobody    3957  0.0  0.5 297272 21584 ?        S    07:55   0:00  \_ /usr/sbin/httpd -k start
nobody    3958  0.0  0.5 297272 21584 ?        S    07:55   0:00  \_ /usr/sbin/httpd -k start
nobody    3959  0.0  0.5 297136 21216 ?        S    07:55   0:00  \_ /usr/sbin/httpd -k start
nobody    3960  0.0  0.5 297272 21584 ?        S    07:55   0:00  \_ /usr/sbin/httpd -k start
 
  • Like
Reactions: MichaelW.

MichaelW.

Member
May 31, 2018
24
5
3
Sweden
cPanel Access Level
Root Administrator
Thanks for both of your replies!

That information really helped me understand how the process works, cPanelLauren.

So in our environment we have PHP-FHM on, and according to WHM the PHP handlers are not applied to PHP-FPM.

Is it recommended to have PHP-FPM on when running event or worker?
Because this is probably what I will end up with if it comes with good stability, security and efficiency.

Also to add, we are not running CloudLinux lsapi.
 

cPanelLauren

Product Owner
Staff member
Nov 14, 2017
13,295
1,254
313
Houston
  • Like
Reactions: MichaelW.

MichaelW.

Member
May 31, 2018
24
5
3
Sweden
cPanel Access Level
Root Administrator
Hello again.

Thanks again for your very informative replies!

I have decided to try out event, and also go with installing mod_http2 to enable that.
If it doesn't give the optimization and performance I am looking for, then I will try worker.

Thanks for all the help!
 
  • Like
Reactions: cPanelLauren