|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head>
|
|
Packit |
90a5c9 |
<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" />
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
Packit |
90a5c9 |
This file is generated from xml source: DO NOT EDIT
|
|
Packit |
90a5c9 |
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
|
|
Packit |
90a5c9 |
-->
|
|
Packit |
90a5c9 |
<title>worker - Apache HTTP Server Version 2.4</title>
|
|
Packit |
90a5c9 |
<link href="../style/css/manual.css" rel="stylesheet" media="all" type="text/css" title="Main stylesheet" />
|
|
Packit |
90a5c9 |
<link href="../style/css/manual-loose-100pc.css" rel="alternate stylesheet" media="all" type="text/css" title="No Sidebar - Default font size" />
|
|
Packit |
90a5c9 |
<link href="../style/css/manual-print.css" rel="stylesheet" media="print" type="text/css" /><link rel="stylesheet" type="text/css" href="../style/css/prettify.css" />
|
|
Packit |
90a5c9 |
<script src="../style/scripts/prettify.min.js" type="text/javascript">
|
|
Packit |
90a5c9 |
</script>
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
<link href="../images/favicon.ico" rel="shortcut icon" /></head>
|
|
Packit |
90a5c9 |
<body>
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
Modules | Directives | FAQ | Glossary | Sitemap
|
|
Packit |
90a5c9 |
Apache HTTP Server Version 2.4
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
Apache > HTTP Server > Documentation > Version 2.4 > Modules
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
Apache MPM worker
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
Available Languages: de |
|
|
Packit |
90a5c9 |
en |
|
|
Packit |
90a5c9 |
fr |
|
|
Packit |
90a5c9 |
ja |
|
|
Packit |
90a5c9 |
tr
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
multi-threaded multi-process web server
|
|
Packit |
90a5c9 |
Status:MPM
|
|
Packit |
90a5c9 |
Module Identifier:mpm_worker_module
|
|
Packit |
90a5c9 |
Source File:worker.c
|
|
Packit |
90a5c9 |
Summary
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
This Multi-Processing Module (MPM) implements a hybrid
|
|
Packit |
90a5c9 |
multi-process multi-threaded server. By using threads to serve
|
|
Packit |
90a5c9 |
requests, it is able to serve a large number of requests with
|
|
Packit |
90a5c9 |
fewer system resources than a process-based server. However, it
|
|
Packit |
90a5c9 |
retains much of the stability of a process-based server by
|
|
Packit |
90a5c9 |
keeping multiple processes available, each with many threads.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
The most important directives used to control this MPM are
|
|
Packit |
90a5c9 |
ThreadsPerChild , which
|
|
Packit |
90a5c9 |
controls the number of threads deployed by each child process and
|
|
Packit |
90a5c9 |
MaxRequestWorkers , which
|
|
Packit |
90a5c9 |
controls the maximum total number of threads that may be
|
|
Packit |
90a5c9 |
launched.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
Topics
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
How it Works
|
|
Packit |
90a5c9 |
Directives
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
CoreDumpDirectory
|
|
Packit |
90a5c9 |
EnableExceptionHook
|
|
Packit |
90a5c9 |
Group
|
|
Packit |
90a5c9 |
Listen
|
|
Packit |
90a5c9 |
ListenBacklog
|
|
Packit |
90a5c9 |
MaxConnectionsPerChild
|
|
Packit |
90a5c9 |
MaxMemFree
|
|
Packit |
90a5c9 |
MaxRequestWorkers
|
|
Packit |
90a5c9 |
MaxSpareThreads
|
|
Packit |
90a5c9 |
MinSpareThreads
|
|
Packit |
90a5c9 |
PidFile
|
|
Packit |
90a5c9 |
ReceiveBufferSize
|
|
Packit |
90a5c9 |
ScoreBoardFile
|
|
Packit |
90a5c9 |
SendBufferSize
|
|
Packit |
90a5c9 |
ServerLimit
|
|
Packit |
90a5c9 |
StartServers
|
|
Packit |
90a5c9 |
ThreadLimit
|
|
Packit |
90a5c9 |
ThreadsPerChild
|
|
Packit |
90a5c9 |
ThreadStackSize
|
|
Packit |
90a5c9 |
User
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
Bugfix checklistSee also
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
Setting which addresses and ports Apache HTTP Server uses
|
|
Packit |
90a5c9 |
Comments
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
A single control process (the parent) is responsible for launching
|
|
Packit |
90a5c9 |
child processes. Each child process creates a fixed number of server
|
|
Packit |
90a5c9 |
threads as specified in the ThreadsPerChild directive, as well
|
|
Packit |
90a5c9 |
as a listener thread which listens for connections and passes them
|
|
Packit |
90a5c9 |
to a server thread for processing when they arrive.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
Apache HTTP Server always tries to maintain a pool of <dfn>spare</dfn> or
|
|
Packit |
90a5c9 |
idle server threads, which stand ready to serve incoming
|
|
Packit |
90a5c9 |
requests. In this way, clients do not need to wait for a new
|
|
Packit |
90a5c9 |
threads or processes to be created before their requests can be
|
|
Packit |
90a5c9 |
served. The number of processes that will initially launch is
|
|
Packit |
90a5c9 |
set by the StartServers
|
|
Packit |
90a5c9 |
directive. During operation, the server assesses the total number
|
|
Packit |
90a5c9 |
of idle threads in all processes, and forks or kills processes to
|
|
Packit |
90a5c9 |
keep this number within the boundaries specified by MinSpareThreads and MaxSpareThreads . Since this
|
|
Packit |
90a5c9 |
process is very self-regulating, it is rarely necessary to modify
|
|
Packit |
90a5c9 |
these directives from their default values. The maximum number of
|
|
Packit |
90a5c9 |
clients that may be served simultaneously (i.e., the maximum total
|
|
Packit |
90a5c9 |
number of threads in all processes) is determined by the
|
|
Packit |
90a5c9 |
MaxRequestWorkers directive.
|
|
Packit |
90a5c9 |
The maximum number of active child processes is determined by
|
|
Packit |
90a5c9 |
the MaxRequestWorkers
|
|
Packit |
90a5c9 |
directive divided by the
|
|
Packit |
90a5c9 |
ThreadsPerChild directive.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
Two directives set hard limits on the number of active child
|
|
Packit |
90a5c9 |
processes and the number of server threads in a child process,
|
|
Packit |
90a5c9 |
and can only be changed by fully stopping the server and then
|
|
Packit |
90a5c9 |
starting it again. ServerLimit
|
|
Packit |
90a5c9 |
is a hard limit on the number of active child
|
|
Packit |
90a5c9 |
processes, and must be greater than or equal to the
|
|
Packit |
90a5c9 |
MaxRequestWorkers
|
|
Packit |
90a5c9 |
directive divided by the
|
|
Packit |
90a5c9 |
ThreadsPerChild directive.
|
|
Packit |
90a5c9 |
ThreadLimit is a hard
|
|
Packit |
90a5c9 |
limit of the number of server threads, and must be greater than
|
|
Packit |
90a5c9 |
or equal to the ThreadsPerChild directive.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
In addition to the set of active child processes, there may
|
|
Packit |
90a5c9 |
be additional child processes which are terminating, but where at
|
|
Packit |
90a5c9 |
least one server thread is still handling an existing client
|
|
Packit |
90a5c9 |
connection. Up to MaxRequestWorkers terminating processes
|
|
Packit |
90a5c9 |
may be present, though the actual number can be expected to be
|
|
Packit |
90a5c9 |
much smaller. This behavior can be avoided by disabling the
|
|
Packit |
90a5c9 |
termination of individual child processes, which is achieved using
|
|
Packit |
90a5c9 |
the following:
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
set the value of
|
|
Packit |
90a5c9 |
MaxConnectionsPerChild to zero
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
set the value of
|
|
Packit |
90a5c9 |
MaxSpareThreads to the same value as
|
|
Packit |
90a5c9 |
MaxRequestWorkers
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
A typical configuration of the process-thread controls in
|
|
Packit |
90a5c9 |
the worker MPM could look as follows:
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
ServerLimit 16
|
|
Packit |
90a5c9 |
StartServers 2
|
|
Packit |
90a5c9 |
MaxRequestWorkers 150
|
|
Packit |
90a5c9 |
MinSpareThreads 25
|
|
Packit |
90a5c9 |
MaxSpareThreads 75
|
|
Packit |
90a5c9 |
ThreadsPerChild 25
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
While the parent process is usually started as root
|
|
Packit |
90a5c9 |
under Unix in order to bind to port 80, the child processes and threads
|
|
Packit |
90a5c9 |
are launched by the server as a less-privileged user. The User and Group directives are used to set
|
|
Packit |
90a5c9 |
the privileges of the Apache HTTP Server child processes. The child processes
|
|
Packit |
90a5c9 |
must be able to read all the content that will be served, but
|
|
Packit |
90a5c9 |
should have as few privileges beyond that as possible. In
|
|
Packit |
90a5c9 |
addition, unless suexec is used,
|
|
Packit |
90a5c9 |
these directives also set the privileges which will be inherited
|
|
Packit |
90a5c9 |
by CGI scripts.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
MaxConnectionsPerChild
|
|
Packit |
90a5c9 |
controls how frequently the server recycles processes by killing
|
|
Packit |
90a5c9 |
old ones and launching new ones.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
This MPM uses the mpm-accept mutex to serialize
|
|
Packit |
90a5c9 |
access to incoming connections when subject to the thundering herd
|
|
Packit |
90a5c9 |
problem (generally, when there are multiple listening sockets).
|
|
Packit |
90a5c9 |
The implementation aspects of this mutex can be configured with the
|
|
Packit |
90a5c9 |
Mutex directive. The performance hints
|
|
Packit |
90a5c9 |
documentation has additional information about this mutex.
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
|
|
Packit |
90a5c9 |
Available Languages: de |
|
|
Packit |
90a5c9 |
en |
|
|
Packit |
90a5c9 |
fr |
|
|
Packit |
90a5c9 |
ja |
|
|
Packit |
90a5c9 |
tr
|
|
Packit |
90a5c9 |
Notice:This is not a Q&A section. Comments placed here should be pointed towards suggestions on improving the documentation or server, and may be removed again by our moderators if they are either implemented or considered invalid/off-topic. Questions on how to manage the Apache HTTP Server should be directed at either our IRC channel, #httpd, on Freenode, or sent to our mailing lists.
|
|
Packit |
90a5c9 |
<script type="text/javascript">
|
|
Packit |
90a5c9 |
var comments_shortname = 'httpd';
|
|
Packit |
90a5c9 |
var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/worker.html';
|
|
Packit |
90a5c9 |
(function(w, d) {
|
|
Packit |
90a5c9 |
if (w.location.hostname.toLowerCase() == "httpd.apache.org") {
|
|
Packit |
90a5c9 |
d.write('
|
|
Packit |
90a5c9 |
var s = d.createElement('script');
|
|
Packit |
90a5c9 |
s.type = 'text/javascript';
|
|
Packit |
90a5c9 |
s.async = true;
|
|
Packit |
90a5c9 |
s.src = 'https://comments.apache.org/show_comments.lua?site=' + comments_shortname + '&page=' + comments_identifier;
|
|
Packit |
90a5c9 |
(d.getElementsByTagName('head')[0] || d.getElementsByTagName('body')[0]).appendChild(s);
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
else {
|
|
Packit |
90a5c9 |
d.write('
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
})(window, document);
|
|
Packit |
90a5c9 |
//--></script>
|
|
Packit |
90a5c9 |
Copyright 2018 The Apache Software Foundation. Licensed under the Apache License, Version 2.0.
|
|
Packit |
90a5c9 |
Modules | Directives | FAQ | Glossary | Sitemap <script type="text/javascript">
|
|
Packit |
90a5c9 |
if (typeof(prettyPrint) !== 'undefined') {
|
|
Packit |
90a5c9 |
prettyPrint();
|
|
Packit |
90a5c9 |
}
|
|
Packit |
90a5c9 |
//--></script>
|
|
Packit |
90a5c9 |
</body></html>
|