Prefork vs. Worker

Apache uses modules called MPM’s or Multi-Processing Modules for the most basic functions of a web server. The default apache setup contains a selection of of these MPM’s which are responsible for binding to network ports on the server, accepting and dispatching child processes to handle the requests from a browser in order to display a webpage.

Most likely you have Prefork running which is supposed to be better for single or dual core cpu systems, and worker is supposed to be better for multi-CPU systems.

Prefork is older technology, based off of the stable Apache 1.3 software. Prefork is also the default MPM for Apache 2.x. Prefork works, but in certain cases, it doesn’t handle large traffic loads as well as Worker.

Servers that were running prefork and were experiencing higher than average traffic usually run more stable with Worker. You will also see an increase in the amount of requests Apache can handle or serve up per second.

Worker uses a multi-process, multi-threaded approach for serving up webpages. By using many threads to serve requests, it is able to run better with less system resources than a individual process based server, yet it retains much of the stability of a process-based server by keeping multiple processes available, each with many threads.

Unfortunately, PHP5 does not work well with the Worker MPM out of the box, but it can be configured to work using CGI or FastCGI. To check your version of php simply run

[root@host] ~ >> php -v
PHP 5.2.9 (cli) (built: Oct 14 2009 03:46:53)

Check with a developer to see if this would be something you would be interested in upgrading to so he can check the sites on the server to make sure they are compatible with using worker.

This is the general idea behind using worker. It may better suit your needs and lower load spikes if it is compatible with your current sites.

More information is available here:

http://httpd.apache.org/docs/2.0/mpm.html
http://httpd.apache.org/docs/2.0/mod/prefork.html
http://httpd.apache.org/docs/2.0/mod/worker.html

g33kadmin

I am a g33k, Linux blogger, developer, student and Tech Writer for Liquidweb.com/kb. My passion for all things tech drives my hunt for all the coolz. I often need a vacation after I get back from vacation....

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.