Apache HTTP Server Version 2.4
Available Languages: tr
Description: | Multi-Processing Module implementing a hybrid multi-threaded multi-process web server |
---|---|
Status: | MPM |
Module Identifier: | mpm_worker_module |
Source File: | worker.c |
This Multi-Processing Module (MPM) implements a hybrid multi-process multi-threaded server. By using threads to serve requests, it is able to serve a large number of requests with fewer system resources than a process-based server. However, it retains much of the stability of a process-based server by keeping multiple processes available, each with many threads.
The most important directives used to control this MPM are MaxRequestWorkers
, which controls the maximum total number of threads that may be launched.
A single control process (the parent) is responsible for launching child processes. Each child process creates a fixed number of server threads as specified in the ThreadsPerChild
directive, as well as a listener thread which listens for connections and es them to a server thread for processing when they arrive.
Apache HTTP Server always tries to maintain a pool of spare or idle server threads, which stand ready to serve incoming requests. In this way, clients do not need to wait for a new threads or processes to be created before their requests can be served. The number of processes that will initially launch is set by the ThreadsPerChild
directive.
Two directives set hard limits on the number of active child processes and the number of server threads in a child process, and can only be changed by fully stopping the server and then starting it again. ThreadsPerChild
directive.
In addition to the set of active child processes, there may be additional child processes which are terminating, but where at least one server thread is still handling an existing client connection. Up to MaxRequestWorkers
terminating processes may be present, though the actual number can be expected to be much smaller. This behavior can be avoided by disabling the termination of individual child processes, which is achieved using the following:
MaxConnectionsPerChild
to zeroMaxRequestWorkers
A typical configuration of the process-thread controls in the worker
MPM could look as follows:
ServerLimit 16 StartServers 2 MaxRequestWorkers 150 MinSpareThreads 25 MaxSpareThreads 75 ThreadsPerChild 25
While the parent process is usually started as root
under Unix in order to bind to port 80, the child processes and threads are launched by the server as a less-privileged . The suexec
is used, these directives also set the privileges which will be inherited by CGI scripts.
MaxConnectionsPerChild
controls how frequently the server recycles processes by killing old ones and launching new ones.
This MPM uses the mpm-accept
mutex to serialize access to incoming connections when subject to the thundering herd problem (generally, when there are multiple listening sockets). The implementation aspects of this mutex can be configured with the performance hints documentation has additional information about this mutex.
Available Languages: tr