httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Paul Querna <c...@outoforder.cc>
Subject Event MPM
Date Mon, 25 Oct 2004 02:30:21 GMT
Several months ago, Greg Ames posted [1] his 'Event Driven MPM' patch as 
a diff to the Worker MPM:
http://apache.org/~gregames/event.patch

I took this patch as the starting point for my 'Event MPM'.

My Patch is split into two parts.

First is a patch to APR that provides an extension to apr_pollset that 
optionally make some parts of it threadsafe.  This patch has been 
submitted to APR before, and hopefully it will get accepted there soon.

The other patch is the actual MPM and with a few changes to other parts 
of the source to take advantage of the Event Thread for handling Keep 
Alive Requests.

These patches total over 160k. Since many mail servers are extremely 
lame, I have put them up on the web at:
http://www.apache.org/~pquerna/event-mpm/

MPM Structure:
I have made the MPM a single process with multiple threads  It currently 
does not spawn new threads on demand, but I plan to add this soon.  By 
making it run as a single process, I was able to completely remove the 
accept() locking.  This also greatly simplifies the Listener Thread's 
poll()`ing of the sockets.

The Listener thread includes all the Sockets that it is listening to for 
incoming requests on in the same pollset as all requests waiting for 
IO/KeepAlive.  Greg's original patch had a separate 'Event' Thread, but 
I have chosen to combine them.  This can also be extended to include the 
Lingering Close patch that Joe Schaefer submitted [2] this August.

The Worker Threads work much like the 'Worker' MPM, but when a 
connection is ready for a Keep Alive, they will push the client back to 
the Listener/Event Thread.  This thread does not need to be woken up 
like in Greg Ames' patch.  This is because of the enhancement to 
apr_pollset that enables other threads to _add() or _remove() while the 
main thread is inside a _poll().


Super-Quick-Yet-Little-Real-Meaning-Benchmarks of Requests per second:

Non-KeepAlive:
  `ab -c 25 -n 100000 http://10.10.10.10:6080/index.html`
  Worker MPM: 2138.28
  Event MPM: 2147.95

KeepAlive:
  `ab -k -c 25 -n 100000 http://10.10.10.10:6080/index.html`
  Worker MPM: 4396.38
  Event MPM: 4119.40

(This is using the EPoll backend on a Linux 2.6 Machine, over 100mbit LAN.).

The place where the Event MPM should shine is with the more common case 
of relatively high-latency Internet clients.  The Event MPM isn't super 
powerful on the KeepAlive-over-LAN case because it forces a context 
switch to process the client again when it is does another request as 
part of a KeepAlive.

I would like to get this into 2.1 CVS relatively soon.  I plan to spend 
more time cleaning it up and tuning it this week.

I know this email is light on some of the implementation details, feel 
free to ask about anything I did :)

I would love feedback on all aspects of the patch. Please feel free to 
rip it apart :)

-Paul Querna

[1] http://marc.theaimsgroup.com/?t=108670503400001&r=1&w=2
[2] http://marc.theaimsgroup.com/?t=109346431300004&r=1&w=2

Mime
View raw message