[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [apache-plusplus] Process model ideas for C++ Apache.



Dean Gaudet wrote:
> This is where it's important to know what threading model is in use... if
> these are all kernel-level threads, then this definately hurts really
> hard.  But if they're user-level threads then context-switches are far
> less expensive.  The memory burn is there either way (I'm worried about
> this in threaded apache -- we have far far far too many 8k buffers on the
> stack).

OTOH, it may be worth the context switches to be able to limit the total
number of threads. Suddenly this all makes sense to me.

> The apache API is actually already positioned to allow explicit switching
> at various sequence points.  In particular, everything hangs off the
> request_rec structure.  The process_request_internal() function which goes
> through the various stages of request processing is essentially just a
> long list of sequence points.  It would be possible to break things up in
> the manner you're proposing right inside this function.   Something we
> should keep in mind while designing a new API...

So the _really_ interesting question is, can we abstract it in such a
way that we can decide whether to do start-to-end processing in a single
thread, or whether to use pools of threads synchronized at the sequence
points, without having to explicitly code for each case? That would be
cool.

Cheers,

Ben.

-- 
Ben Laurie            |Phone: +44 (181) 735 0686|  Apache Group member
Freelance Consultant  |Fax:   +44 (181) 735 0689|http://www.apache.org
and Technical Director|Email: ben@algroup.co.uk |
A.L. Digital Ltd,     |Apache-SSL author    http://www.apache-ssl.org/
London, England.      |"Apache: TDG" http://www.ora.com/catalog/apache