Please whitelist cPanel in your adblocker so that you’re able to see our version release promotions, thanks!

The Community Forums

Interact with an entire community of cPanel & WHM users!

Prefork vs Event Apache 2.4

Discussion in 'EasyApache' started by MichaelW., Aug 20, 2018.

  1. MichaelW.

    MichaelW. Member

    Joined:
    May 31, 2018
    Messages:
    24
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    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?
     
    #1 MichaelW., Aug 20, 2018
    Last edited: Aug 20, 2018
  2. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,716
    Likes Received:
    436
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    MichaelW. likes this.
  3. MichaelW.

    MichaelW. Member

    Joined:
    May 31, 2018
    Messages:
    24
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    Sweden
    cPanel Access Level:
    Root Administrator
    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?
     
  4. dalem

    dalem Well-Known Member PartnerNOC

    Joined:
    Oct 24, 2003
    Messages:
    2,883
    Likes Received:
    118
    Trophy Points:
    368
    Location:
    SLC
    cPanel Access Level:
    DataCenter Provider
    you need to switch to php-cgi or suphp
    or
    if running CloudLinux lsapi
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,716
    Likes Received:
    436
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    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:
    [root@server ~]# httpd -M |grep mpm
     mpm_prefork_module (shared)
    [root@server ~]# 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:
    [root@server ~]# 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
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    MichaelW. likes this.
  6. MichaelW.

    MichaelW. Member

    Joined:
    May 31, 2018
    Messages:
    24
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    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.
     
  7. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,716
    Likes Received:
    436
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    MichaelW. likes this.
  8. MichaelW.

    MichaelW. Member

    Joined:
    May 31, 2018
    Messages:
    24
    Likes Received:
    5
    Trophy Points:
    3
    Location:
    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!
     
    cPanelLauren likes this.
  9. cPanelLauren

    cPanelLauren Forums Analyst II Staff Member

    Joined:
    Nov 14, 2017
    Messages:
    5,716
    Likes Received:
    436
    Trophy Points:
    233
    Location:
    Houston
    cPanel Access Level:
    DataCenter Provider
    Hi @MichaelW.

    That's a great plan and please let us know if you have any questions along the way!

    Thanks!
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
    MichaelW. likes this.
Loading...

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice