0

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.

1
  • Have you considered the couple nginx+php-fpm? Really performance effective.
    – Déjà vu
    Dec 22, 2010 at 18:35

3 Answers 3

0

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?

2
  • The database is on a separate server.
    – mikewaters
    Dec 24, 2010 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: serverfault.com/questions/214448/… Jan 2, 2011 at 2:31
1

Apache has two MPM modules that are in broad use - the Worker MPM and the Pre-fork MPM. PHP.net 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.

0

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.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .