Friday, January 28, 2011

use prefork or worker in apache configuration ?

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 ?

specification:

Ram:4G

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

grep -c processor /proc/cpuinfo 8

max Size Per Apache process:23M

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

    From joschi
  • 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
    From DaveG

0 comments:

Post a Comment