Apache is the most popular web server for Linux web servers. Most of the Linux system administrator’s start with Apache (httpd) web server from there learning phase, Even I also used Apache web server during learning. At the initial level the System administrator works with Apache. Most of them used default configuration but they don’t know how Apache works, how it handles incoming connection or multiple processes.
Apache uses one of following MPM (Multi-Processing Module) for handling incoming requests and processes them. Both have their own working type. Below is some basic details about both MPM and there working.
Prefork MPM launches multiple child processes. Each child process handle one connection at a time.
Prefork uses high memory in comparison to worker MPM. Prefork is the default MPM used by Apache2 server. Preform MPM always runs few minimum (MinSpareServers) defined processes as spare, so new requests do not need to wait for new process to start.
Worker MPM generates multiple child processes similar to prefork. Each child process runs many threads. Each thread handles one connection at a time.
In sort Worker MPM implements a hybrid multi-process multi-threaded server. Worker MPM uses low memory in comparison to Prefork MPM.
Event MPM is introduced in Apache 2.4, It is pretty similar to worker MPM but it designed for managing high loads.
This MPM allows more requests to be served simultaneously by passing off some processing work to supporting threads. Using this MPM Apache tries to fix the ‘keep alive problem’ faced by other MPM. When a client completes the first request then the client can keep the connection open, and send further requests using the same socket, which reduces connection overload.