Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a PHP application that is database-intensive, and can run for many hours processing and making thousands of external network connections.

Less than 3 users will be connected to this application at any time.

Which apache mpm is most suitable for this workload, prefork/mod_php or worker/mod_fcgid?

I am using Debian Lenny x64, single core, 4GB ram.

share|improve this question
Have you considered the couple nginx+php-fpm? Really performance effective. – ringø Dec 22 '10 at 18:35
up vote 0 down vote accepted

For slower machines, worker mode works better and generates lower CPU usage & load.
For powerful machines serving static content, prefork mpm is about 5% faster.

I recommend if you have a chance to do some tests with apache benchmark: Apache Benchmark

Also, you can take a look at this benchmark: Apache prefork vs. worker

Your database engine is installed on the same server?

share|improve this answer
The database is on a separate server. – mikewaters Dec 24 '10 at 21:24
Ok, if you have a database-intensive PHP application, your database server will need to be a powerful machine too (RAM & Processor). As a recomendation, good database structure and faster queries can help a lot. Make some improvements in your apache and database config files, look at my answer in this thread:… – Matias Dominoni Jan 2 '11 at 2:31

Apache has two MPM modules that are in broad use - the Worker MPM and the Pre-fork MPM. recommends that you use the Pre-fork MPM, while most site optimization experts would push you to utilize the threaded Worker MPM. Surprisingly, load testing showed a relatively small performance difference - and certainly not one that would push you towards a non-recommended implementation on your server.

share|improve this answer

Worker + PHP thru FastCGI tend to work well, historically a lot of people advised against using mod_php with any threaded MPM (because of some 4rd party libraies that weren't working very well with that), using FastCGI basically "detaches" PHP from webserver, avoiding that problem.

Another plus is that now apache thread/process size is smaller, sou you can use more threads/processes for webserver (serving static content) and have few PHP processes doing dynamic parts of site.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.