Home » Centos/RHEL » Apache » Check which MPM (Multi processing module) apache is running

Check which MPM (Multi processing module) apache is running

MPM (Multi processing module) is a component of apache webserver, that determines how multiple clients or connections will be handled. Apache is flexible by design and there are different MPMs that can be used with apache webserver depending on the needs. Some of the common MPMs on Linux are below:

1. Prefork
2. Worker
3. Peruser
4. mpm-ITK

Each of the mpm has its own pros and cons. Apache doc page on mpms is here.
Worker:-

Worker Multi-Processing Module implements a hybrid multi-process multi-threaded webserver. By using threads to serve requests, and it is able to serve a huge number of requests with less system resources than a process-based server.
it provides much of the stability of a process-based server by keeping multiple processes available, each with many threads.
ThreadsPerChilds are most important directives used to control this MPM, which controls the number of threads created by each child process and MaxClients, which controls the maximum total number of threads that may be launched.

Prefork:-

Prefork Multi-Processing Module implements a non-threaded, pre-forking web server that handles requests as similar to Apache older version 1.3. It is useful for sites that need to avoid threading for compatibility with non-thread-safe libraries. It is the best MPM for isolating each request, so that a problem with a single request will not affect any other.

A single control process is responsible for launching child processes which listen for connections and serve them when they arrive. Apache always tries to maintain several spare or idle server processes, which stand ready to serve incoming requests. In this way, clients do not need to wait for a new child processes to be forked before their requests can be served.

Apache can run only one of them at a time. MPMs are not modules that are loaded by apache. Instead they are compiled into apache.
To check which mpm apache is using run the following command :

CentOS
On CentOS Apache is called httpd

#whereis httpd

httpd: /usr/sbin/httpd /etc/httpd.old /etc/httpd
List the apache details

#httpd -l
Compiled in modules:
core.c
mod_authn_file.c
mod_authn_default.c
mod_authz_host.c
mod_authz_groupfile.c
mod_authz_user.c
mod_authz_default.c
mod_auth_basic.c
mod_include.c
mod_filter.c
mod_deflate.c
mod_log_config.c
mod_logio.c
mod_env.c
mod_expires.c
mod_headers.c
mod_unique_id.c
mod_setenvif.c
mod_version.c
mod_proxy.c
mod_proxy_connect.c
mod_proxy_ftp.c
mod_proxy_http.c
mod_proxy_scgi.c
mod_proxy_ajp.c
mod_proxy_balancer.c
mod_ssl.c
prefork.c
http_core.c

It shows the prefork.c So mpm prefork is running

#httpd -V
Server version: Apache/2.2.24 (Unix)
Server built: Jul 5 2013 02:11:56
Cpanel::Easy::Apache v3.18.18 rev9999
Server’s Module Magic Number: 20051115:31
Server loaded: APR 1.4.6, APR-Util 1.4.1
Compiled using: APR 1.4.6, APR-Util 1.4.1
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=”/usr/local/apache”
-D SUEXEC_BIN=”/usr/local/apache/bin/suexec”
-D DEFAULT_PIDLOG=”logs/httpd.pid”
-D DEFAULT_SCOREBOARD=”logs/apache_runtime_status”
-D DEFAULT_LOCKFILE=”logs/accept.lock”
-D DEFAULT_ERRORLOG=”logs/error_log”
-D AP_TYPES_CONFIG_FILE=”conf/mime.types”
-D SERVER_CONFIG_FILE=”conf/httpd.conf”

The mpm information is :
Server MPM: Prefork
threaded: no
forked: yes (variable process count)

On Ubauntu

#apache2 -l
Compiled in modules:
core.c
mod_log_config.c
mod_logio.c
prefork.c
http_core.c
mod_so.c
#apache2 -V
Server version: Apache/2.2.14 (Ubuntu)
Server built: Mar 5 2012 16:41:39
Server’s Module Magic Number: 20051115:23
Server loaded: APR 1.3.8, APR-Util 1.3.9
Compiled using: APR 1.3.8, APR-Util 1.3.9
Architecture: 32-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=””
-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=”/etc/apache2/mime.types”
-D SERVER_CONFIG_FILE=”/etc/apache2/apache2.conf”

It shows the prefork.c So mpm prefork is running.

About

I am founder and webmaster of www.linuxpcfix.com and working as a Sr. Linux Administrator (Expertise on Linux/Unix & Cloud Server) and have been in the industry from last 7 years.

Leave a Reply

Your email address will not be published. Required fields are marked *

*
*

Time limit is exhausted. Please reload the CAPTCHA.

Categorized Tag Cloud