From: Luca Toscano
A | B | C | D | E | F | G | H | I | K | L | M | N | O | P | Q | R | S | T | U | V | W | X
+A | B | C | D | E | F | G | H | I | K | L | M | N | O | P | Q | R | S | T | U | V | X
Available Languages: de | diff --git a/docs/manual/mod/event.html.en b/docs/manual/mod/event.html.en index 8cd0ea489d..7a6ddcb550 100644 --- a/docs/manual/mod/event.html.en +++ b/docs/manual/mod/event.html.en @@ -38,12 +38,8 @@ of consuming threads only for connections with active processing
The event
Multi-Processing Module (MPM) is
designed to allow more requests to be served simultaneously by
- passing off some processing work to supporting threads, freeing up
- the main threads to work on new requests. It is based on the
- worker
MPM, which implements a hybrid
- multi-process multi-threaded server. Run-time configuration
- directives are identical to those provided by
- worker
.
To use the event
MPM, add
--with-mpm=event
to the configure
@@ -52,6 +48,7 @@ of consuming threads only for connections with active processing
event
is based on the worker
MPM, which implements a hybrid
+multi-process multi-threaded server. 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 passes them to a worker thread for processing when they arrive.
Run-time configuration directives are identical to those provided by worker
, with the only addition
+of the AsyncRequestWorkerFactor
.
This MPM tries to fix the 'keep alive problem' in HTTP. After a client
- completes the first request, the client can keep the connection
- open, and send further requests using the same socket. This can
- save significant overhead in creating TCP connections. However,
- Apache HTTP Server traditionally keeps an entire child process/thread waiting
- for data from the client, which brings its own disadvantages. To
- solve this problem, this MPM uses a dedicated thread to handle both
- the Listening sockets, all sockets that are in a Keep Alive state,
- and sockets where the handler and protocol filters have done their work
- and the only remaining thing to do is send the data to the client. The
- status page of mod_status
shows how many connections are
- in the mentioned states.
The improved connection handling may not work for certain connection
- filters that have declared themselves as incompatible with event. In these
- cases, this MPM will fall back to the behaviour of the
- worker
MPM and reserve one worker thread per connection.
- All modules shipped with the server are compatible with the event MPM.
A similar restriction is currently present for requests involving an - output filter that needs to read and/or modify the whole response body, - like for example mod_ssl, mod_deflate, or mod_include. If the - connection to the client blocks while the filter is processing the - 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.
- -The MPM assumes that the underlying apr_pollset
- implementation is reasonably threadsafe. This enables the MPM to
- avoid excessive high level locking, or having to wake up the listener
- thread in order to send it a keep-alive socket. This is currently
- only compatible with KQueue and EPoll.
The total amount of connections that a single process/threads block can handle is regulated
+ by the AsyncRequestWorkerFactor
directive.
Async connections would need a fixed dedicated worker thread with the previous MPMs but not with event.
+ The status page of mod_status
shows new columns under the Async connections section:
write()
to the socket returns EWOULDBLOCK
or EAGAIN
, 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.
+ KeepAliveTimeout
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.These improvements are valid for both HTTP/HTTPS connections.
+ + + +The improved connection handling may not work for certain connection
+ filters that have declared themselves as incompatible with event. In these
+ cases, this MPM will fall back to the behaviour of the
+ worker
MPM and reserve one worker thread per connection.
+ All modules shipped with the server are compatible with the event MPM.
A similar restriction is currently present for requests involving an + output filter that needs to read and/or modify the whole response body, + like for example mod_ssl, mod_deflate, or mod_include. If the + connection to the client blocks while the filter is processing the + 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. Please note that + this limitation is only a corner case, it does not mean that the event MPM + defaults to worker in presence of TLS/SSL connections and/or compression.
+ +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 EWOULDBLOCK
+ or EAGAIN
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/proxed 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
+ server's stability and memory footprint.
+
The event model was made possible by the introduction of new APIs into the supported operating systems:
+Before these new APIs where made available, the traditional select
and poll
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.
The MPM assumes that the underlying apr_pollset
+ implementation is reasonably threadsafe. This enables the MPM to
+ avoid excessive high level locking, or having to wake up the listener
+ thread in order to send it a keep-alive socket. This is currently
+ only compatible with KQueue and EPoll.
worker
MPM with the goal
-of consuming threads only for connections with active processingA | B | C | D | E | F | H | I | L | M | N | P | R | S | U | V | W | X
+A | B | C | D | E | F | H | I | L | M | N | P | R
sed
syntaxAvailable Languages: de | diff --git a/docs/manual/sitemap.html.en b/docs/manual/sitemap.html.en index ae1f6e4f85..25dbce0e73 100644 --- a/docs/manual/sitemap.html.en +++ b/docs/manual/sitemap.html.en @@ -279,7 +279,6 @@ log_server_status