Skip to main content

Using 'Global Configuration' for MPM Worker

Comments

6 comments

  • cPanelMichael
    Hello, The "Max Request Workers" directive sets the limit on the number of simultaneous requests that will be served. This interface allows up to the value of the ServerLimit setting. This used to be called 'MaxClients' prior to Apache 2.4. The MPM Worker module directs Apache to fork into several processes so that a single crash will not kill the entire Apache process. Each forked process creates numerous threads and a listener thread that listens for connections. Additional documentation is available from Apache at: worker - Apache HTTP Server Version 2.4 Could you review this document and let us know of any additional questions? Thank you.
    0
  • kdean
    . When I read online advice, I'm told to set Max Request Workers to Server Limit x 25 (default number of threads per process) but cPanel won't let me exceed the value of 'Server Limit'.

    The WHM Global Configuration interface doesn't properly handle Worker and Event settings. Seems like they've only thought about Prefork. Yes, your MaxRequestWorkers setting should be 150 with a ServerLimit of 6 and a ThreadsPerChild of 25, but as you saw the WHM interface won't accept that value because it treats MaxRequestWorkers like Prefork's MaxClients setting which shouldn't exceed the ServerLimit but Worker and Event needs to allow it to exceed because of the ServerLimit x ThreadsPerChild = MaxRequestWorkers issue. I get around it by manually editing the file. /var/cpanel/conf/apache/local and change the "MaxClients" setting to the correct MaxRequestWorkers value and then rebuild and restart apache. (Yes, even though you're set to Worker or Event, the cPanel config file still saves it as MaxClients even though that's not correct, but when Apache rebuilds its output correctly as MaxRequestWorkers) Rebuild Apache script: /scripts/rebuildhttpdconf Restart Apache: /scripts/restartsrv_apache So, basically cPanel needs to fix their Global Configuration to work correctly if it is to be used with Worker and Event MPMs. Maybe even add settings for ThreadsPerChild, MinSpareThreads and MaxSpareThreads which I currently set with the Include Editor "Pre Main Include".
    ThreadsPerChild 25 MinSpareThreads 100 # Max must be >= (MinSpareThreads + ThreadsPerChild) MaxSpareThreads 200 ThreadsPerChild 25 MinSpareThreads 100 # Max must be >= (MinSpareThreads + ThreadsPerChild) MaxSpareThreads 200
    0
  • kdean
    Someone posted a Feature Request on this 2 years ago but it's apparently "Archived" now whatever that means. Maybe it wasn't clear to cPanel when it was submitted. apache 2.4 MaxRequestWorkers
    0
  • cPanelMichael
    Hello, That request is archived, but I encourage you to open a new feature request for added flexibility when configuring those values: Submit A Feature Request Thank you.
    0
  • sahostking
    The WHM Global Configuration interface doesn't properly handle Worker and Event settings. Seems like they've only thought about Prefork. Yes, your MaxRequestWorkers setting should be 150 with a ServerLimit of 6 and a ThreadsPerChild of 25, but as you saw the WHM interface won't accept that value because it treats MaxRequestWorkers like Prefork's MaxClients setting which shouldn't exceed the ServerLimit but Worker and Event needs to allow it to exceed because of the ServerLimit x ThreadsPerChild = MaxRequestWorkers issue. I get around it by manually editing the file. /var/cpanel/conf/apache/local and change the "MaxClients" setting to the correct MaxRequestWorkers value and then rebuild and restart apache. (Yes, even though you're set to Worker or Event, the cPanel config file still saves it as MaxClients even though that's not correct, but when Apache rebuilds its output correctly as MaxRequestWorkers) Rebuild Apache script: /scripts/rebuildhttpdconf Restart Apache: /scripts/restartsrv_apache So, basically cPanel needs to fix their Global Configuration to work correctly if it is to be used with Worker and Event MPMs. Maybe even add settings for ThreadsPerChild, MinSpareThreads and MaxSpareThreads which I currently set with the Include Editor "Pre Main Include".
    ThreadsPerChild 25 MinSpareThreads 100 # Max must be >= (MinSpareThreads + ThreadsPerChild) MaxSpareThreads 200 ThreadsPerChild 25 MinSpareThreads 100 # Max must be >= (MinSpareThreads + ThreadsPerChild) MaxSpareThreads 200

    Interesting. This may actually explain why when we changed to MPM Event in Easy Apache and try increasing the values we still get the message to increase max request workers in error_log. Are you saying we just add this to Pre main include and all should work fine? ThreadsPerChild 25 MinSpareThreads 100 # Max must be >= (MinSpareThreads + ThreadsPerChild) MaxSpareThreads 200 ThreadsPerChild 25 MinSpareThreads 100 # Max must be >= (MinSpareThreads + ThreadsPerChild) MaxSpareThreads 200
    0
  • kdean
    In addition to the Pre main includes, you need to manually modify the Apache local file and rebuild. So, since your threads per child is 25, let's say you want MaxRequestWorkers to 1000. You would edit the Apache local file and set maxclients to 1000 and serverlimit to 40. (40 x 25 = 1000). If you try to make these changes directly in WHM's Apache Configuration, it won't let you and will say the ServerLimit is too low. It want's you to set the ServerLimit to 1000 also, but that would technically be 25,000 workers.
    0

Please sign in to leave a comment.