Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I'm quite new to configuring apache. There is planty of tutorials but rarely comprehensive how to do something.

What i'm wondering is:

  1. How do i change which MPM profile to be used my apache?
  2. How do i calculate what is the optimum number of clients and connections in apache2.conf, this server is mainly used for multiple CMS systems like wordpress etc. With caching included?

Server i'm using is: XEON E3-1230 (4 x 3,2 GHz) and 16 GB DDR3 EEC. I hope further description is irrelevant.

This is what i have in /etc/apache2/apache2.conf

# prefork MPM
<IfModule mpm_prefork_module>
    StartServers          5
    MinSpareServers       5
    MaxSpareServers      10
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# worker MPM
<IfModule mpm_worker_module>
    StartServers          2
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxClients          150
    MaxRequestsPerChild   0
</IfModule>

# event MPM
<IfModule mpm_event_module>
    StartServers          2
    MaxClients          150
    MinSpareThreads      25
    MaxSpareThreads      75 
    ThreadLimit          64
    ThreadsPerChild      25
    MaxRequestsPerChild   0
</IfModule>

Apache modules:

# apache2ctl -l
Compiled in modules:
  core.c
  mod_log_config.c
  mod_logio.c
  prefork.c
  http_core.c
  mod_so.c

Other:

Server version: Apache/2.2.16 (Debian)


# apache2ctl -V
Server version: Apache/2.2.16 (Debian)
Server built:   Mar  3 2013 12:09:44
Server's Module Magic Number: 20051115:24
Server loaded:  APR 1.4.2, APR-Util 1.3.9
Compiled using: APR 1.4.2, APR-Util 1.3.9
Architecture:   64-bit
Server MPM:     Prefork
  threaded:     no
    forked:     yes (variable process count)
Server compiled with....
 -D APACHE_MPM_DIR="server/mpm/prefork"
 -D APR_HAS_SENDFILE
 -D APR_HAS_MMAP
 -D APR_HAVE_IPV6 (IPv4-mapped addresses enabled)
 -D APR_USE_SYSVSEM_SERIALIZE
 -D APR_USE_PTHREAD_SERIALIZE
 -D SINGLE_LISTEN_UNSERIALIZED_ACCEPT
 -D APR_HAS_OTHER_CHILD
 -D AP_HAVE_RELIABLE_PIPED_LOGS
 -D DYNAMIC_MODULE_LIMIT=128
 -D HTTPD_ROOT="/etc/apache2"
 -D SUEXEC_BIN="/usr/lib/apache2/suexec"
 -D DEFAULT_PIDLOG="/var/run/apache2.pid"
 -D DEFAULT_SCOREBOARD="logs/apache_runtime_status"
 -D DEFAULT_LOCKFILE="/var/run/apache2/accept.lock"
 -D DEFAULT_ERRORLOG="logs/error_log"
 -D AP_TYPES_CONFIG_FILE="mime.types"
 -D SERVER_CONFIG_FILE="apache2.conf"
share|improve this question

1 Answer 1

up vote 1 down vote accepted

MPMs are configured in to your apache server at compile time. So to use a different MPM you would have to recompile apache, or install a different pre compiled binary with the desired MPM (if it is available for your OS). However for most purposes the prefork MPM is just fine, especially if you're going to run PHP. PHP is not considered thread safe, so you shouldn't use worker, and event is experimental...

So stay with prefork and the only parameters of relevance to you are the one in the <IfModule mpm_prefork_module> section. What the best values are for you mainly depends on how many concurrent users you expect, and how that varies. I would start with just leaving the parameters as they are, and only start performance tuning if you really run in to performance issues. Use the status page to look at how many clients typically connect to your server. If you do end up serving more than 150 concurrent users increas MaxClients.

share|improve this answer
    
I have no idea how many users could be visiting, just want to prepare it to take maximum load that hardware can take. –  mariotanenbaum Apr 9 '13 at 7:54

Your Answer

 
discard

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.