[Mongrel] multi threaded theoretically useful?
wyhaines at gmail.com
Sat Sep 8 21:31:48 EDT 2007
On 9/8/07, Ashley Moran <work at ashleymoran.me.uk> wrote:
> Interesting! What about the case of long-running requests, eg file
> uploads, outgoing web service requests or complex calculations? Do
> you have any of those, and if so, how does it affect the balance of
> event-based vs multithreaded?
File uploads -- the most efficient way to deal with these is really to
run a separate, dedicated mini-app just for them. If I remember my
history correctly, this is actually what originally gave rize to Merb.
Ezra needed something fast and lightweight to efficiently handle file
In Ruby, a dedicated file upload handler running event based, though,
will still outperform the multithreaded approach. That might make an
interesting topic for a blog post sometime soon....
Regarding accessing web services, it all depends on whether those
accesses are done in a way that block other threads or not. If they
do not, then heavy web service access would be a place where latencies
could also be captured.
Heavy calculations, on the other hand, are a hands down winner for the
single threaded approach. There are no latencies to capture -- it's
CPU all the way, so you just need to bring all the resources available
to the process to bear on one problem at a time.
More information about the Mongrel-users