mpm_worker_module, increase concurrent users

Discussion in 'Installation/Configuration' started by iceget, Nov 9, 2021.

  1. iceget

    iceget Member

    dear community,

    i have a question about the basic "default" setup from debian with current ispconfig version.
    how much "concurrent users" are predefined, and how i can increase that?
    i had the problem that my server closes the connection after about 500 users connects to it.

    can i increase that if i edit this file:
    /etc/apache2/mods-available/mpm_worker.conf

    I am using PHP-Fast-CGI with a selected PHP-Version they i have installed.

    Thank you so much

    many greets
     
  2. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    This is /etc/apache2/mods-available/mpm_worker.conf from debian, not ubuntu, but likely is the same (though MaxRequestWorkers of 150 doesn't line up with your "about 500", so maybe this is not your issue):
    Code:
    # worker MPM
    # StartServers: initial number of server processes to start
    # MinSpareThreads: minimum number of worker threads which are kept spare
    # MaxSpareThreads: maximum number of worker threads which are kept spare
    # ThreadLimit: ThreadsPerChild can be changed to this maximum value during a
    #                         graceful restart. ThreadLimit can only be changed by stopping
    #                         and starting Apache.
    # ThreadsPerChild: constant number of worker threads in each server process
    # MaxRequestWorkers: maximum number of threads
    # MaxConnectionsPerChild: maximum number of requests a server process serves
    
    <IfModule mpm_worker_module>
            StartServers                     2
            MinSpareThreads          25
            MaxSpareThreads          75
            ThreadLimit                      64
            ThreadsPerChild          25
            MaxRequestWorkers         150
            MaxConnectionsPerChild   0
    </IfModule>
    
    Yes, that would be the config file. https://httpd.apache.org/docs/2.4/mod/worker.html for more info.
     
    Last edited: Nov 10, 2021
  3. iceget

    iceget Member

    thank you for your reply, one question: is there a possibility with command line to ask the current "configuration" what is loaded?
    that means the values that i have added in this file, that i can then through apache command see if this values are correct loaded?

    and what is the difference for mpm_prefork and mpm_worker?

    is it better to use the prefork or the worker?

    thank you!
     
    Last edited: Nov 9, 2021
  4. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    prefork is single thread only. worker (and event) are multi-threaded.

    worker will serve more connections, faster, and using less system resources than prefork. (caveat: prefork is actually faster if you only serve one request at a time)
    in worker, threads are attached to connections, not requests. a long keep-alive persistent connection will keep hold of a thread until it's closed. event uses a dedicated thread to handle the keep-alive connections, event generally uses a bit less system resources than worker. event behaved identically to worker when using ssl connections on apache 2.2, it provides the same improvements over worker when using ssl connections on apache 2.4.

    i have seen some arguments that worker might be a better option when using apache as a proxy, though they were posted around 3 years ago, may no longer still be the case.

    in pretty much all real world use cases, worker and event are going to be better options than prefork.
    i think event will normally be very slightly faster, and consume slightly less resources, worker might be a little bit more stable.
    but there's not going to be massive differences between worker and event.

    personally, i always set apache to use mpm_event, and so far, it's never been the cause of any problems.
     
  5. iceget

    iceget Member

    Thank you so much for your reply.

    Can you maybe tell how i can change from prefork to worker / events? in my case i have tried this but getting this message:
    [email protected]:/# a2dismod mpm_prefork
    ERROR: The following modules depend on mpm_prefork and need to be disabled first: php7.3
    [email protected]:/# a2enmod mpm_worker
    Considering conflict mpm_event for mpm_worker:
    Considering conflict mpm_prefork for mpm_worker:
    ERROR: Module mpm_prefork is enabled - cannot proceed due to conflicts. It needs to be disabled first!

    i have installed more php versions for selecting in web PHP Fast CGI (7.1, 7.2, 7.3 and 7.4).

    thank you
     
  6. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    a2dismod mpm_prefork
    a2dismod php7.3
    a2enmod mpm_event (or mpm_worker if you prefer)
    systemctl restart apache2.service

    you may also need to 'a2enconf php7.3-fpm' if it isn't already enabled.
    also may need 'a2enmod proxy_fcgi setenvif', possibly also enable 'a2enmod alias rewrite', although i'd expect them to already be enabled.
    it''ll also be worth running 'a2enmod http2 ssl' as well before restarting apache2. ssl may already be enabled, but http2 won't be if you're using mod_php
     
    iceget likes this.
  7. iceget

    iceget Member

    Thank you so much, now i have changed to worker.

    one question: i have in no website apache directives set, but only (in this case server-status have activated it for see the status for the Server MPM: worker) works only on all webs with acitvated php 7.1.
    i have tried to open DOMAIN/server-status. on all PHP 7.1 webs its showing up, but on all other nothing appear (only i get 404).

    but all other website (7.2, 7.3 and 7.4) i cannot open this page. but i would configure the worker globally for server.
    how i can handle that?

    thank you so much for your help
     
  8. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    The mpm module in use is the same for all sites, there is no difference between what php version a site uses, or if it has php disabled. The /server-status location is probably the same, handled in global apache config for all sites. What do you have in /etc/apache2/mods-enabled/status.conf and what does 'grep -R server-status /etc/apache2/' show?
     
  9. iceget

    iceget Member

    Thank you so much for your help. It seems that my .htaccess file from Wordpress has not allowed the access. i have renamed the .htaccess to _htaccess. Now i can access the page.

    thank you so much for your help. this was really helpful for me.
    many greets
     
  10. iceget

    iceget Member

    dear Jesse Norell,

    i have one question, after that i have done that, i get know on phpmyadmin this error, how can i fix this? can it be that now another php version will be used for phpmyadmin?

    thank you!

    Image:
    [​IMG]
     
  11. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    Phpmyadmin will use the default php interpreter, maybe you enabled the wrong one, or multiple ones? What do you have in /etc/apache2/conf-enabled?
     
  12. iceget

    iceget Member

    Thank you so much Jesse,

    i have this in my conf enabled:
    [email protected]:/etc/apache2/conf-enabled# ls -lsa
    insgesamt 8
    4 drwxr-xr-x 2 root root 4096 Nov 11 04:57 .
    4 drwxr-xr-x 8 root root 4096 Nov 9 22:49 ..
    0 lrwxrwxrwx 1 root root 34 Mär 23 2020 apache2-doc.conf -> ../conf-available/apache2-doc.conf
    0 lrwxrwxrwx 1 root root 30 Mär 23 2020 charset.conf -> ../conf-available/charset.conf
    0 lrwxrwxrwx 1 root root 30 Mär 23 2020 httpoxy.conf -> ../conf-available/httpoxy.conf
    0 lrwxrwxrwx 1 root root 44 Mär 23 2020 localized-error-pages.conf -> ../conf-available/localized-error-pages.conf
    0 lrwxrwxrwx 1 root root 24 Mär 23 2020 mailman.conf -> /etc/mailman/apache.conf
    0 lrwxrwxrwx 1 root root 46 Mär 23 2020 other-vhosts-access-log.conf -> ../conf-available/other-vhosts-access-log.conf
    0 lrwxrwxrwx 1 root root 33 Nov 11 04:57 php7.4-fpm.conf -> ../conf-available/php7.4-fpm.conf
    0 lrwxrwxrwx 1 root root 33 Mär 23 2020 phpmyadmin.conf -> ../conf-available/phpmyadmin.conf
    0 lrwxrwxrwx 1 root root 32 Mär 23 2020 roundcube.conf -> ../conf-available/roundcube.conf
    0 lrwxrwxrwx 1 root root 31 Mär 23 2020 security.conf -> ../conf-available/security.conf
    0 lrwxrwxrwx 1 root root 36 Mär 23 2020 serve-cgi-bin.conf -> ../conf-available/serve-cgi-bin.conf

    Thank you
     
  13. iceget

    iceget Member

    dear Jesse,

    i have now configured the server with these settings:
    Code:
    # default
    #<IfModule mpm_worker_module>
    #       StartServers                     2
    #       MinSpareThreads          25
    #       MaxSpareThreads          75
    #       ThreadLimit                      64
    #       ThreadsPerChild          25
    #       MaxRequestWorkers         150
    #       MaxConnectionsPerChild   0
    #</IfModule>
    
    <IfModule mpm_worker_module>
            ServerLimit 250
            StartServers 10
            MinSpareThreads 75
            MaxSpareThreads 250
            ThreadLimit 64
            ThreadsPerChild 32
            MaxRequestWorkers 8000
            MaxConnectionsPerChild 10000
    </IfModule>
    Is there a way to determine these values in order to adapt them to the hardware and performance? currently i think i will probably want too much from my server with 8000 connections, right?

    My Hardware:
    Dell Power Edge R640
    CPUS: 32 CPUs x Intel(R) Xeon(R) Gold 5218 CPU @ 2.30GHz
    RAM: 128 GB
    SSDs: 4 x 1TB (RAID10)

    thank you so much
     
  14. Taleman

    Taleman Well-Known Member HowtoForge Supporter

    Internet Search Engines with
    Code:
    tuning mpm_worker_module
    seem to find useful looking articles.
     
  15. Jesse Norell

    Jesse Norell ISPConfig Developer Staff Member ISPConfig Developer

    That depends on what the processes handling those connections are doing, if they're all sitting idle waiting for some event/resource, you could surely handle many more than that, but if they're all very cpu intensive, you might have your system pretty well maxed with less than 50 connections. I've never looked for any profiling tools for apache specifically; for the OS itself you can install and enable sysstat to get an idea of what the system is doing (cpu, memory, io, etc.). Once you identify a bottleneck you can see what can be done to eliminate/improve that.
     
  16. nhybgtvfr

    nhybgtvfr Well-Known Member HowtoForge Supporter

    for the phpmyadmin error, for your initial attempt to switch to php-fpm:

    and from what you posted on friday:
    i believe you should only enable the default php-fpm version, which judging by the mod_php you were using before, is php7.3-fpm.
    changing that may fix your problem. (may not, but it will avoid other problems)
     

Share This Page