What are Apache MPMs, Apache Prefork, Worker and Event MPM?November 23, 2022
What are Apache MPMs?
An Apache MPM (Multi-Processing Module) is a module that helps Apache web server software handle multiple requests at the same time. The Apache web server is a popular open-source web server that is used by many websites. The MPM modules are designed to improve the performance of the server by using different methods to process requests. There are different MPMs available, and each one has its own advantages and disadvantages.
How Do Multi-Processing Modules Work?
Multi-processing modules (MPMs) are programs that enable a Web server to handle multiple requests simultaneously. Each MPM has a different way of handling requests, but they all share the same goal: to improve the server‘s performance.
MPMs work by creating a pool of child processes that can handle incoming requests. When a request comes in, the MPM assigns it to one of the child processes. The child process then handles the request and sends the response back to the client.
MPMs can improve performance in two ways: by increasing the number of requests that can be handled simultaneously, and by reducing the time it takes to handle each request. By handling more requests at once, the server can reduce its overall response time. And by reducing the time it takes to handle each request, the server can free up resources sooner and be able to handle more requests in a given period of time. There are several different MPMs available, each with its own advantages and disadvantages. The most popular MPMs prefork, worker, and event.
What are Prefork MPM and worker MPM?
The Prefork MPM is the original MPM for Apache and is the basis for other MPMs. It is a process-based server in which each request is handled by a separate child process. This provides good compatibility with a wide range of modules and platforms.
Worker MPM is a newer MPM that was designed to address some of the shortcomings of Prefork. In Worker, multiple processes are used, but each process contains multiple threads. This allows requests to be handled more efficiently than in Prefork since threads can share data between them.
So, what is Event MPM?
This MPM is designed to address the ‘keep alive problem’ in HTTP. By keeping the connection open after the first request is completed, subsequent requests can be made using the same socket, resulting in a significant reduction in overhead from creating TCP connections.
This MPM uses a dedicated listener thread for each process to handle both the Listening sockets and all sockets that are in a Keep Alive state. This eliminates the disadvantage of having an entire child process/thread waiting for data from the client.
What are the differences?
Apache MPM, or Multi-Processing Modules, are modules that control how Apache handles requests. There are three different MPMs: prefork, worker, and event.
The prefork MPM is the default module on most systems. It creates a separate process for each request. This can be more resource intensive but is more compatible with older modules and libraries.
The worker MPM shares a single process between multiple threads. This is more efficient with resources but can be less compatible with some modules and libraries.
The event MPM is the most recent addition. It uses a single thread to handle requests, but multiple processes to handle different events. This makes it the most efficient with resources, but also the least compatible with some modules and libraries.
How to tell if I’m running Apache in prefork or worker MP
You can figure out which MPM is configured by looking at the list of compiled modules. To do this, run the apache binary with the -l flag in the root shell.
[…] long-tail keywords may have low search volume, they can still be effective. By targeting specific, high-quality keywords, you can attract the right kind of visitors to your […]
[…] is then allocated to customers according to their needs. This allows each customer to have their own private space on the same physical server while sharing resources like bandwidth and storage with other customers […]