Apache MPM-Multi Processing Module
MPM stands for Multiple Processing Modules. The main purpose of MPM is binding network ports on machine, accepting request and dispatching children to handle the requets.
Apache implements specialised MPM. MPM must be chosen while configuring and must be compiled in the server. MPM behaves like Apache module, the basic difference is only one MPM must be loaded into the server at any time. MPM are not actually modules that are loaded by apache. Instead they are compiled into apache.
We can compare MPM as an aperture which is responsible for accepting requests, spawning child processes; based on requests assigning child process and processing the request
List of Apache MPM modules are available. Refer the link for the same :-
Some of the well know and widely implemented MPM’s :-
CHECK WHICH MPM IS ACTIVE ?
#httpd –V or
#/usr/sbin/httpd –V | grep MPM
TYPES OF MPM :-
Basically, there are two major MPM’s
1) Prefork :-
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 idle processes, which are ready to serve incoming requests. Therefore, client do not need to wait for a new child processes to be forked before their requests can be served.
“The prefork MPM runs multiple processes with each child process handling one connection”.
Prefork are non-threaded MPM
Preform is the default module given by an Apache.
-Stable and Secure
-Compatible with all implementations (cgi, fcgi, suPHP, DSO).
-Failure of one process won’t affect other connections.
-Simultaneous execution of multiple processes >> indicates more memory usage.
A typical configuration of the process controls in the Preform MPM could look as follows:
2) Worker :-
Asingle control process that is, parent process is responsible for launching child processes. Each child process creates a fixed number of server threads as specified in the configuration, as well as listener thread which listens for connections and passes them to server for processing.
“The worker MPM has one control process that launches multi-threaded child processes which handles one connection per thread”.
Worker is a threaded MPM
-Multi-threaded design utilizes less memory usage irrespective of high connections.
-DSO Module Incompatible.
A typical configuration of the process-thread controls in the Worker MPM could look as follows: