A have apache server version (Apache/2.2.13) and I want to use MPM module But I do not know what use prefork or worker and what configurations I need ?



CPU:Intel(R) Xeon(R) CPU E5405 @ 2.00GHz

grep -c processor /proc/cpuinfo 8

max Size Per Apache process:23M

  • 1
    What is Apache serving? A dynamic language like PHP as a module? CGI? Static documents? – Lekensteyn Oct 24 '10 at 12:28

The answer is "it depends" -- things which it could depend upon:

  1. Are you planning on using PHP with your Apache environment? If so then using the worker MPM might not be for you see this link as certain PHP modules aren't thread-safe.

  2. Are you planning on performing operations which might require locking of files? If so then using the worker MPM might not be for you. Threads are not full POSIX processes and therefore don't necessarily obey file locking operations.

    An example of this is Subversion version < 1.5 - these versions made use of apr and apr-util libraries using Berkeley DB for performing commits. Berkeley DB relies upon locking therefore this could result in commits which corrupt your repositories

The key thing to do is to figure out what you're trying to do with your Apache service - how are you trying to serve things, how are the back-end processes operating to construct the data to be served.

  • Are you just interfacing with a Tomcat service via mod_proxy or AJP? It's usually okay to go with the worker.
  • Are you doing things with Apache modules (SVN, PHP are two examples)? In that case prefork might be safer.
  • Are you using NFS (doesn't always support filesystem locking properly)? Again prefork probably the safer option.

YMMV - but ultimately you need to understand the architecture underlying things to make a true judgement call on this. If you don't understand the architecture then go with prefork as it's the safer route.

  • web server working with perl website – jalal allam Oct 24 '10 at 12:46

If you use only threadsafe modules (e.g., mod_php without any non-threadsafe extensions) you should definitely go for MPM worker, since it is more suited for modern systems (multiple processes, multiple threads).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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