I know you know Apache. You know the main configuration file of Apache server. I also know that you know the default document root of apache server and I also know that you are also familiar with the directory index parameter of apache.
But, did you know that your friendly apache server can be made to run in two different modes?
Apache can be started in two different modes:
1. Prefork mode. (default)
2. Worker mode.
In the prefork mode, a master httpd process is started and this master process will start different httpd servers.
Whereas, in the worker mode one httpd process is active, and it uses different threads to serve client requests.
Even if the worker mode is a bit more efficient with regard to resource usage, some modules cannot handle it (like mod_php), and therefore the prefork mode is used as default.
On most of the systems, speed of both the MPMs is comparable but prefork uses more memory than worker.
GEEKS, now the question is which one to use?
On high traffic websites worker is preferable because of low memory usage as comparison to prefork MPM (Multi Processing Module) but prefork is more safe if you are using libraries which are not thread safe, like mod_php.
So in a nutshell.
– prefork MPM uses multiple child processes with one thread each.
– Each process handles one connection at a time and uses more memory.
– Good for non-thread-safe third party modules.
– worker MPM uses multiple child processes with many threads each.
– Each thread handles one connection at a time.
– Good for high-traffic, smaller memory footprint.
Now the point here is that GEEKS, how can I tell which mode I am running in?
Well, you can either use the –
to get your answer.
Here is a illustration from my machine.
Keep learning with us.