Some installations of Apache will have been compiled to work with either Prefork or Worker MPM, but most by default are compiled only to work with Prefork. Changing to Worker MPM may allow your server to handle much higher traffic, more user sessions, with less RAM use. Your site or server will not scale well if it is running Prefork MPM. Worker is a bit more difficult to set up properly, and has some restrictions regarding functionality of PHP scripts.
- To determine which MPM is running:
- If you see worker.c in the list of loaded modules, your Apache is running Worker MPM. If prefork.c, it is running prefork.
- To determine if apache has Worker MPM compiled in:
- If you see worker.c in the list of compiled-in modules, Apache can run Worker MPM.
Here is some useful info to help if your installation of Apache will work with Worker MPM:
- Un-Comment HTTPD=/usr/sbin/httpd.worker in
- restart apache
- do some performance testing and raise your worker server and thread limits to sane levels in httpd.conf
If you need to recompile Apache and PHP, then you should do more research. Recompiling is not a trivial process.
I found that my server had much better memory usage under Worker MPM, however:
- some scripts (squirrelmail, phpmyadmin) do not work on a per-domain basis and must be run direct to the actual server process with symlinked directories. This is much more efficient but less convenient for virtual domain owners
- some /dev processes took on strange group permissions, getting the gid of the first user in the apache group.
- browser caching was not well supported… the dreaded “blank screen between page loads” occurred more frequently under Worker MPM than Prefork MPM… also login/logout was sketchy on some sites… not sure why but my guess is that sessions may not be quite persistent using Worker vs Prefork due to cookie confusion… possible that multi-threading does not track cookies well.