From 11bb63ef4aeccc7ebe89ed5cbe8419ad571d1e39 Mon Sep 17 00:00:00 2001
From: Luca Toscano
Date: Fri, 2 Dec 2016 14:56:50 +0000
Subject: [PATCH] Add a section to mpm-event's documentation to advertise new
changes
I tried to add a summary of Stefan's last patches just backported to
2.4.x today. I've read all of them and tried to report Stefan's comment
from PR 53555 as much as possible. Please review and let me know if I wrong
something incorrect or not precise enough.
git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@1772357 13f79535-47bb-0310-9956-ffa450edef68
---
docs/manual/mod/event.xml | 52 ++++++++++++++++++++++++++++++++++++++-
1 file changed, 51 insertions(+), 1 deletion(-)
diff --git a/docs/manual/mod/event.xml b/docs/manual/mod/event.xml
index 7ea5872105..33fb808ae2 100644
--- a/docs/manual/mod/event.xml
+++ b/docs/manual/mod/event.xml
@@ -104,10 +104,60 @@ of the AsyncRequestWorkerFactor.
+ Graceful process termination and Scoreboard usage
+ This mpm showed some scalability bottlenecks in the past leading to the following
+ error: "scoreboard is full, not at MaxRequestWorkers".
+ MaxRequestWorkers
+ limits the number of simultaneous requests that will be served at any given time
+ and also the number of allowed processes
+ (MaxRequestWorkers
+ / ThreadsPerChild), meanwhile
+ the Scoreboad 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 MaxRequestWorkers,
+ 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
+ ListenBacklog). Most of the times
+ the threads are stuck in the Graceful state, namely they are waiting to
+ finish their work with a TCP connection to terminate and free a
+ scoreboard slot (for example handling long running requests, slow clients
+ or a connection with keep-alive enabled). Two scenarios are very common:
+
+ - Httpd graceful restart.
+ - When the server load goes down in a way that causes httpd to
+ stop some processes (for example due to
+ MaxSpareThreads).
+ This is particularly problematic because when the load increases again,
+ httpd will try to start more processes.
+ If the pattern repeats, the number of processes can rise quite a bit.
+
+
+ From 2.4.24 onward, mpm-event is smarter and it is able to handle
+ graceful terminations in a much better way. Some of the improvements are:
+
+ - Allow the use of all the scoreboard slots up to
+ ServerLimit.
+ - Force gracefully finishing processes to close their
+ connections in keep-alive state.
+ - 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).
+ - If the scoreboard is full, prevent more processes to finish
+ gracefully due to reduced load until old processes have terminated
+ (otherwise the situation would get worse once the load increases again).
+
+ The behavior described in the last point is completely observable via
+ mod_status in the connection summary table through two new
+ columns: "Slot" and "Stopping". The former indicates the PID and
+ the latter if the process is stopping or not; the extra state "Yes (old gen)"
+ indicates a process still running after a graceful restart.
+
+
Limitations
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
+ cases, this MPM will fall back to the behavior of the
worker MPM and reserve one worker thread per connection.
All modules shipped with the server are compatible with the event MPM.
--
2.50.1