diff options
Diffstat (limited to 'docs/manual/mod/event.html.en')
-rw-r--r-- | docs/manual/mod/event.html.en | 67 |
1 files changed, 36 insertions, 31 deletions
diff --git a/docs/manual/mod/event.html.en b/docs/manual/mod/event.html.en index 9b80b01..57130a5 100644 --- a/docs/manual/mod/event.html.en +++ b/docs/manual/mod/event.html.en @@ -1,7 +1,7 @@ -<?xml version="1.0" encoding="ISO-8859-1"?> +<?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"><head> -<meta content="text/html; charset=ISO-8859-1" http-equiv="Content-Type" /> +<meta content="text/html; charset=UTF-8" http-equiv="Content-Type" /> <!-- XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX This file is generated from xml source: DO NOT EDIT @@ -27,13 +27,13 @@ <div id="preamble"><h1>Apache MPM event</h1> <div class="toplang"> <p><span>Available Languages: </span><a href="../en/mod/event.html" title="English"> en </a> | -<a href="../fr/mod/event.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> +<a href="../fr/mod/event.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> </div> <table class="module"><tr><th><a href="module-dict.html#Description">Description:</a></th><td>A variant of the <code class="module"><a href="../mod/worker.html">worker</a></code> MPM with the goal of consuming threads only for connections with active processing</td></tr> <tr><th><a href="module-dict.html#Status">Status:</a></th><td>MPM</td></tr> -<tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>mpm_event_module</td></tr> -<tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>event.c</td></tr></table> +<tr><th><a href="module-dict.html#ModuleIdentifier">Module Identifier:</a></th><td>mpm_event_module</td></tr> +<tr><th><a href="module-dict.html#SourceFile">Source File:</a></th><td>event.c</td></tr></table> <h3>Summary</h3> <p>The <code class="module"><a href="../mod/event.html">event</a></code> Multi-Processing Module (MPM) is @@ -118,24 +118,29 @@ of the <code class="directive">AsyncRequestWorkerFactor</code>.</p> The status page of <code class="module"><a href="../mod/mod_status.html">mod_status</a></code> shows new columns under the Async connections section:</p> <dl> <dt>Writing</dt> - <dd>While sending the response to the client, it might happen that the TCP write buffer fills up because the connection is too slow. Usually in this case a <code>write()</code> to the socket returns <code>EWOULDBLOCK</code> or <code>EAGAIN</code>, to become writable again after an idle time. The worker holding the socket might be able to offload the waiting task to the listener thread, that in turn will re-assign it to the first idle worker thread available once an event will be raised for the socket (for example, "the socket is now writable"). Please check the Limitations section for more information. + <dd>While sending the response to the client, it might happen that the TCP write buffer fills up because the connection is too slow. + Usually in this case, a <code>write()</code> to the socket returns <code>EWOULDBLOCK</code> or <code>EAGAIN</code> to become writable again after an idle time. + The worker holding the socket might be able to offload the waiting task to the listener thread, that in turn will re-assign it to the first idle worker thread available once an event will be raised for the socket (for example, "the socket is now writable"). + Please check the Limitations section for more information. </dd> <dt>Keep-alive</dt> <dd>Keep Alive handling is the most basic improvement from the worker MPM. Once a worker thread finishes to flush the response to the client, it can offload the - socket handling to the listener thread, that in turns will wait for any event from the + socket handling to the listener thread, that in turn will wait for any event from the OS, like "the socket is readable". If any new request comes from the client, then the listener will forward it to the first worker thread available. Conversely, if the <code class="directive"><a href="../mod/core.html#keepalivetimeout">KeepAliveTimeout</a></code> occurs then the socket will be - closed by the listener. In this way the worker threads are not responsible for idle - sockets and they can be re-used to serve other requests.</dd> + closed by the listener. In this way, the worker threads are not responsible for idle + sockets, and they can be re-used to serve other requests.</dd> <dt>Closing</dt> <dd>Sometimes the MPM needs to perform a lingering close, namely sending back an early error to the client while it is still transmitting data to httpd. Sending the response and then closing the connection immediately is not the correct thing to do since the client (still trying to send the rest of the - request) would get a connection reset and could not read the httpd's response. The lingering close is time bounded but it can take relatively long - time, so it's offloaded to a worker thread (including the shutdown hooks and real socket close). From 2.4.28 onward this is also the + request) would get a connection reset and could not read the httpd's response. + The lingering close is time-bounded, but it can take a relatively long + time, so it's offloaded to a worker thread (including the shutdown hooks and real socket close). + From 2.4.28 onward, this is also the case when connections finally timeout (the listener thread never handles connections besides waiting for and dispatching their events). </dd> </dl> @@ -145,33 +150,33 @@ of the <code class="directive">AsyncRequestWorkerFactor</code>.</p> <h3><a name="graceful-close" id="graceful-close">Graceful process termination and Scoreboard usage</a></h3> - <p>This mpm showed some scalability bottlenecks in the past leading to the following + <p>This mpm showed some scalability bottlenecks in the past, leading to the following error: "<strong>scoreboard is full, not at MaxRequestWorkers</strong>". <code class="directive"><a href="../mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code> limits the number of simultaneous requests that will be served at any given time and also the number of allowed processes (<code class="directive"><a href="../mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code> - / <code class="directive"><a href="../mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code>), meanwhile + / <code class="directive"><a href="../mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code>); meanwhile, the Scoreboard is a representation of all the running processes and the status of their worker threads. If the scoreboard is full (so all the threads have a state that is not idle) but the number of active requests served is not <code class="directive"><a href="../mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code>, it means that some of them are blocking new requests that could be served but that are queued instead (up to the limit imposed by - <code class="directive"><a href="../mod/mpm_common.html#listenbacklog">ListenBacklog</a></code>). Most of the times + <code class="directive"><a href="../mod/mpm_common.html#listenbacklog">ListenBacklog</a></code>). Most of the time, the threads are stuck in the Graceful state, namely they are waiting to finish their work with a TCP connection to safely terminate and free up a - scoreboard slot (for example handling long running requests, slow clients + scoreboard slot (for example, handling long-running requests, slow clients or connections with keep-alive enabled). Two scenarios are very common:</p> <ul> - <li>During a <a href="../stopping.html#graceful">graceful restart</a>. - The parent process signals all its children to complete + <li>During a <a href="../stopping.html#graceful">graceful restart</a>, + the parent process signals all its children to complete their work and terminate, while it reloads the config and forks new processes. If the old children keep running for a while before stopping, the scoreboard will be partially occupied until their slots are freed. </li> - <li>When the server load goes down in a way that causes httpd to - stop some processes (for example due to + <li>The server load goes down in a way that causes httpd to + stop some processes (for example, due to <code class="directive"><a href="../mod/mpm_common.html#maxsparethreads">MaxSpareThreads</a></code>). This is particularly problematic because when the load increases again, httpd will try to start new processes. @@ -187,7 +192,7 @@ of the <code class="directive">AsyncRequestWorkerFactor</code>.</p> <code class="directive"><a href="../mod/mpm_common.html#serverlimit">ServerLimit</a></code>. <code class="directive"><a href="../mod/mpm_common.html#maxrequestworkers">MaxRequestWorkers</a></code> and <code class="directive"><a href="../mod/mpm_common.html#threadsperchild">ThreadsPerChild</a></code> are used - to limit the amount of active processes, meanwhile + to limit the amount of active processes; meanwhile, <code class="directive"><a href="../mod/mpm_common.html#serverlimit">ServerLimit</a></code> takes also into account the ones doing a graceful close to allow extra slots when needed. The idea is to use @@ -200,7 +205,7 @@ of the <code class="directive">AsyncRequestWorkerFactor</code>.</p> <li>During graceful shutdown, if there are more running worker threads than open connections for a given process, terminate these threads to free resources faster (which may be needed for new processes).</li> - <li>If the scoreboard is full, prevent more processes to finish + <li>If the scoreboard is full, prevent more processes from finishing gracefully due to reduced load until old processes have terminated (otherwise the situation would get worse once the load increases again).</li> </ul> @@ -224,14 +229,14 @@ of the <code class="directive">AsyncRequestWorkerFactor</code>.</p> data, and the amount of data produced by the filter is too big to be buffered in memory, the thread used for the request is not freed while httpd waits until the pending data is sent to the client.<br /> - To illustrate this point we can think about the following two situations: + To illustrate this point, we can think about the following two situations: serving a static asset (like a CSS file) versus serving content retrieved from FCGI/CGI or a proxied server. The former is predictable, namely the event MPM has full visibility on the end of the content and it can use events: the worker thread serving the response content can flush the first bytes until <code>EWOULDBLOCK</code> or <code>EAGAIN</code> is returned, delegating the rest to the listener. This one in turn - waits for an event on the socket, and delegates the work to flush the rest of the content - to the first idle worker thread. Meanwhile in the latter example (FCGI/CGI/proxied content) + waits for an event on the socket and delegates the work to flush the rest of the content + to the first idle worker thread. Meanwhile in the latter example (FCGI/CGI/proxied content), the MPM can't predict the end of the response and a worker thread has to finish its work before returning the control to the listener. The only alternative is to buffer the response in memory, but it wouldn't be the safest option for the sake of the @@ -249,7 +254,7 @@ of the <code class="directive">AsyncRequestWorkerFactor</code>.</p> </ul> <p>Before these new APIs where made available, the traditional <code>select</code> and <code>poll</code> APIs had to be used. Those APIs get slow if used to handle many connections or if the set of connections rate of change is high. - The new APIs allow to monitor much more connections and they perform way better when the set of connections to monitor changes frequently. So these APIs made it possible to write the event MPM, that scales much better with the typical HTTP pattern of many idle connections.</p> + The new APIs allow to monitor many more connections, and they perform way better when the set of connections to monitor changes frequently. So these APIs made it possible to write the event MPM, that scales much better with the typical HTTP pattern of many idle connections.</p> <p>The MPM assumes that the underlying <code>apr_pollset</code> implementation is reasonably threadsafe. This enables the MPM to @@ -279,7 +284,7 @@ of the <code class="directive">AsyncRequestWorkerFactor</code>.</p> <ul> <li>To use this MPM on FreeBSD, FreeBSD 5.3 or higher is recommended. - However, it is possible to run this MPM on FreeBSD 5.2.1, if you + However, it is possible to run this MPM on FreeBSD 5.2.1 if you use <code>libkse</code> (see <code>man libmap.conf</code>).</li> <li>For NetBSD, at least version 2.0 is recommended.</li> @@ -310,9 +315,9 @@ of the <code class="directive">AsyncRequestWorkerFactor</code>.</p> <p>To mitigate this problem, the event MPM does two things:</p> <ul> - <li>it limits the number of connections accepted per process, depending on the + <li>It limits the number of connections accepted per process, depending on the number of idle request workers;</li> - <li>if all workers are busy, it will + <li>If all workers are busy, it will close connections in keep-alive state even if the keep-alive timeout has not expired. This allows the respective clients to reconnect to a different process which may still have worker threads available.</li> @@ -399,8 +404,8 @@ max_connections = (AsyncRequestWorkerFactor + 1) * MaxRequestWorkers </div> <div class="bottomlang"> <p><span>Available Languages: </span><a href="../en/mod/event.html" title="English"> en </a> | -<a href="../fr/mod/event.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> -</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />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 <a href="http://httpd.apache.org/lists.html">mailing lists</a>.</div> +<a href="../fr/mod/event.html" hreflang="fr" rel="alternate" title="Français"> fr </a></p> +</div><div class="top"><a href="#page-header"><img src="../images/up.gif" alt="top" /></a></div><div class="section"><h2><a id="comments_section" name="comments_section">Comments</a></h2><div class="warning"><strong>Notice:</strong><br />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 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 Libera.chat, or sent to our <a href="https://httpd.apache.org/lists.html">mailing lists</a>.</div> <script type="text/javascript"><!--//--><![CDATA[//><!-- var comments_shortname = 'httpd'; var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/event.html'; @@ -418,7 +423,7 @@ var comments_identifier = 'http://httpd.apache.org/docs/2.4/mod/event.html'; } })(window, document); //--><!]]></script></div><div id="footer"> -<p class="apache">Copyright 2019 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> +<p class="apache">Copyright 2024 The Apache Software Foundation.<br />Licensed under the <a href="http://www.apache.org/licenses/LICENSE-2.0">Apache License, Version 2.0</a>.</p> <p class="menu"><a href="../mod/">Modules</a> | <a href="../mod/directives.html">Directives</a> | <a href="http://wiki.apache.org/httpd/FAQ">FAQ</a> | <a href="../glossary.html">Glossary</a> | <a href="../sitemap.html">Sitemap</a></p></div><script type="text/javascript"><!--//--><![CDATA[//><!-- if (typeof(prettyPrint) !== 'undefined') { prettyPrint(); |