
bojan at rexursive
Oct 18, 2009, 12:35 AM
Post #5 of 21
(2075 views)
Permalink
|
On Fri, 2009-10-16 at 08:00 +1100, Bojan Smojver wrote: > While playing with slowloris against prefork, I wrote the attached > craziness. Here is another take on the problem, call it "Craziness 2.0". The idea here is that a busy server is highly unlikely to be stuck reading using all its children over a maintenance interval (i.e. we expect at least one of those readers to turn into something else during the interval). So, if we find that all children are stuck reading, we simply close the sockets (SIGINT was chosen arbitrarily for this - it should probably be something else). After closing the socket by force, we go back to handling new requests, but this time without the need to fork more children, which should be more gentle on the machine running the thing. Similar approach may work for worker too, but sockets would have to be remembered in thread specific variables and signalling would have to be per-thread. As always, glad to provide entertainment to the list ;-) -- Bojan
|