Apache MPM worker vs prefork

find what MPM Apache is using, it will either be using "worker" or "prefork"

apachectl -l
Compiled in modules:
  core.c
  prefork.c
  http_core.c
  mod_so.c


In my case it is "prefork"

vi /etc/httpd/conf/httpd.conf

Find the section that looks like this (by default one will normally exist for prefork and for worker, but in my case I only care about prefork since prefork is what is compiled in):

# prefork MPM
# StartServers: number of server processes to start
# MinSpareServers: minimum number of server processes which are kept spare
# MaxSpareServers: maximum number of server processes which are kept spare
# ServerLimit: maximum value for MaxClients for the lifetime of the server
# MaxClients: maximum number of server processes allowed to start
# MaxRequestsPerChild: maximum number of requests a server process serves
<IfModule prefork.c>
StartServers      8
MinSpareServers   5
MaxSpareServers   20
ServerLimit      2000
MaxClients       5000
MaxRequestsPerChild  4000
</IfModule>

As some have mentioned the MPM prefork/worker sections are VERY important they affect both stability and performance.
In my case I'm the most concerned because I keep getting the MaxClients error message/hung Apache process without error (where Apache thinks it's running but can't connect and yet most of the time nothing in the debug log shows a problem).

Enable Debug:

Speaking of that you might want to enable this for debugging if you're having the issues I've seen (the crash but even with debug it often won't show the true error)

Add this to your config file:  Loglevel debug

Back to the issue, prefork means a new process/server is started for each new connection to the web server.

My new settings:

<IfModule prefork.c>
StartServers      200
MinSpareServers   50
MaxSpareServers   200
ServerLimit      400
MaxClients       1000
MaxRequestsPerChild  0
</IfModule>


 WARNING: MaxClients of 1000 exceeds ServerLimit value of 400 servers,
 lowering MaxClients to 400.  To increase, please see the ServerLimit
 directive.

Change ServerLimit to "4000" and restart


Tags:

apache, mpm, vs, preforkfind, quot, prefork, apachectl, compiled, modules, http_core, mod_so, vi, etc, httpd, conf, default, startservers, server, processes, minspareservers, maxspareservers, maximum, serverlimit, maxclients, maxrequestsperchild, requests, serves, ifmodule, sections, stability, debug, enable, debugging, ve, config, loglevel, settings, exceeds, servers, lowering, directive, restart,

Latest Articles

  • FreePBX 17 How To Add a Trunk
  • Docker Container Onboot Policy - How to make sure a container is always running
  • FreePBX 17 How To Add Phones / Extensions and Register
  • Warning: The driver descriptor says the physical block size is 2048 bytes, but Linux says it is 512 bytes. solution
  • Cisco How To Use a Third Party SIP Phone (eg. Avaya, 3CX)
  • Cisco Unified Communication Manager (CUCM) - How To Add Phones
  • pptp / pptpd not working in DD-WRT iptables / router
  • systemd-journald high memory usage solution
  • How to Install FreePBX 17 in Linux Debian Ubuntu Mint Guide
  • How To Install Cisco's CUCM (Cisco Unified Communication Manager) 12 Guide
  • Linux Ubuntu Redhat How To Extract Images from PDF
  • Linux and Windows Dual Boot Issue NIC Won't work After Booting Windows
  • Cisco CME How To Enable ACD hunt groups
  • How to install gns3 on Linux Ubuntu Mint
  • How to convert audio for Asterisk .wav format
  • Using Cisco CME Router with Asterisk as a dial-peer
  • Cisco CME How To Configure SIP Trunk VOIP
  • Virtualbox host Only Network Error Failed to save host network interface parameter - Cannot change gateway IP of host only network
  • Cisco CME and C7200 Router Testing and Learning Environment on Ubuntu 20+ Setup Tutorial Guide
  • Abusive IP ranges blacklist