Apache MPM perchild
This module is not functional. Development of this module is not
complete and is not currently active. Do not use
unless you are a programmer willing to
help fix it.
This Multi-Processing Module (MPM) implements a hybrid
multi-process, multi-threaded web server. A fixed number of
processes create threads to handle requests. Fluctuations in
load are handled by increasing or decreasing the number of
threads in each process.
A single control process launches the number of child processes
indicated by the
directive at server startup. Each child process creates threads as
specified in the
The individual threads then
listen for connections and serve them when they arrive.
Apache 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 new
threads to be created. For each child process, Apache assesses
the number of idle threads and creates or destroys threads to
keep this number within the boundaries specified by
Since this process is very self-regulating, it is rarely
necessary to modify these directives from their default values.
The maximum number of clients that may be served simultaneously
is determined by multiplying the number of server processes
that will be created (
NumServers) by the maximum
number of threads created in each process
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 Apache as a less-privileged user. The
Group directives are used to
set the privileges of the Apache child processes. The child
processes must be able to read all the content that will be
served, but should have as few privileges beyond that as
possible. In addition, unless
suexec is used,
these directives also set the privileges which will be inherited
by CGI scripts.
controls how frequently the
server recycles processes by killing old ones and launching new
perchild MPM adds the extra ability to
specify that particular processes should serve requests under
different user-IDs. These user-IDs can then be associated with
specific virtual hosts. You have to use one
ChildPerUserID directive for
every user/group combination you want to be run. Then you can tie
particular virtual hosts to that user and group IDs.
The following example runs 7 child processes. Two of them are run
group1. The next four are run
group2 and the remaining
process uses the
of the main server:
ChildPerUserID user1 group1 2
ChildPerUserID user2 group2 4
Using unbalanced numbers of processes as above is useful, if the
particular virtual hosts produce different load. The assignment to
the virtual hosts is easily done as in the example below. In
conclusion with the example above the following assumes, that
server2 has to serve about twice of the hits of
# no assignment; use fallback
AssignUserID user1 group1
AssignUserID user2 group2
Tie a virtual host to a specific user/group combination. Requests
addressed to the virtual host where this directive appears will be
served by a process running with the specified user and group ID.
The user and group ID has to be assigned to a number of children
in the global server config using the
ChildPerUserID directive. See the section above for a
Specify a user ID and group ID for a number of child processes.
The third argument, num-children, is the number of child
processes to start with the specified user and group. It does
not represent a specific child number. In order to use this
directive, the server must be run initially as
If you start the server as a non-root user, it will fail to change
to the lesser privileged user.
If the total number of child processes, found by totaling all of the
third arguments to all
in the config file, is less than
NumServers, then all remaining children will inherit the
Group settings from the main server.
See the section above for a configuration
Don't set user-id (or group-id) to
root unless you know exactly what you are doing, and
what the dangers are.
This directive sets the maximum number of threads that will be
created in each child process. To increase this value beyond its
default, it is necessary to change the value of the
ThreadLimit directive and stop and
re-start the server.
NumServers directive determines the number
of children alive at the same time. This number should be large enough to
handle the requests for the entire site. To increase this value beyond the
8, it is necessary to change the value of the
ServerLimit directive and stop
and re-start the server. See the section above for a configuration example.