[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [apache-plusplus] Process model ideas for C++ Apache.
I think I can summarize our differences in perspective, based on
the type of project and experience. Correct me if I'm wrong ...
Dean Gaudet wrote:
> What I mean by that is that in general, it is only the
> kernel that is completely aware of the parallelism available
> in the hardware.
You would prefer to leave synchronization to the kernel by using
single fiber start-to-end processing of requests, even though
that means more threads with the memory burn and cache misses
that that implies. This applies only to user-level threads
(fibers) since kernel-level threads also add a context switch
to each thread's scheduling.
You also don't like the extra complexity of state machines,
partially because they imply application-level synchronization.
Dean Gaudet wrote:
> The state of the message in your system is actually a state
> of CPU scheduling as well -- because different threads
> are scheduled in different states. In your system it appears
> that a single message has the latency of at least 4 context
> switches. I don't see the need to burden the request path with
> unnecessary context switches.
My preference is to split I/O functionality and thus use fewer
threads, at the cost of application-induced context switches.
Memory usage should improve as should cache hits. Besides the
disadvantage of user-induced context switches, program complexity
is increased by managing message state and pools of messages
and connections.
The trade-off is that pools/state allows many features (ie.
message store-and-forward, message multiplexing, queueing etc.)
that aren't (yet) required in an httpd that are very useful
in a MOM.
If my synopsis is correct, its easy to see how we came to
different process models based on the type of project. Its
also evident that crossovers of process model are warranted
based on threading model, hardware resources, and project
requirements (such as message multiplexing).
And people wonder why this stuff is so hard ...
--
Mike Anderson
mka@redes.int.com.mx
+52 473 23730 voice/fax
Guanajuato, GTO, Mexico
"If it looks like a bug, waddles like a bug,
and quacks like a bug, its a quack!"