
 Threading In Ruby - nickb
http://dev.zeraweb.com/threading-in-ruby/
======
rcoder
Color me the unimpressed.

Anyone writing an article promoting the use of threaded concurrency and using
PHP as an example of threading done right obviously doesn't know what they're
talking about. PHP has basically zero support for threads, and historically
has basically barred you from using the threading MPMs in your Apache setup,
too, since so few extension modules were thread safe.

Even worse, he obviously has some trouble understanding the relationship
between threads and processes in any modern multi-tasking OS, which leads him
to say silly FUD-esque things about processes being unable to effectively
utilize multi-core systems.

Threads are just processes that share some state. They offer no inherent
performance advantages over plain processes in a "shared-nothing"
architecture, unless your bottleneck is copying of data between processes on a
single machine.

A fully-threaded Rails stack would kick ass for one reason: RAM. Instead of
having 6, 8, or more 100+ MB Mongrel listeners, you could have a single
150-200 MB process with only one copy of its shared state, loaded libraries,
etc.

------
tptacek
How can demand-threading _possibly_ be faster or more memory-efficient than
event processing? Web apps are, to a one, I/O bound. Event programming
schedules those applications on I/O.

The hand-waving on threading bugs is funny, too. "They're both hard, they both
have learning curves!". Nobody has ever livelocked competing events. It's
awfully hard to serialize an entire event-based program on a single shared
variable. This post gives me the impression of an author who has never scaled
real threaded code.

------
wmf
Apparently the author thinks that "event-driven" means "multi-process", which
it doesn't. This mistake made the article pretty unreadable for me.

For the curious, the Flash paper provides a good overview of this topic:
<http://www.cs.princeton.edu/~vivek/flash_usenix_99/>

------
gcv
I stopped reading at this sentence: "Ruby itself uses 'green threads,' which
is basically faking it." Erlang has green threads, too, and it has excellent
threading performance and ease of use.

