Thursday, 7 June 2007

I really don't like threading

One of the things I like about the design of Rails is that it isn't thread safe. Are you mad I hear you cry. No I'm just old enough to remember a time before threads when life was much simpler - we just had processes.

I find Rails and Ruby so nice to use because they keep things very simple and deterministic. So when the "let's get Rails thread safe" brigade start up, I'm happy to point out that things are a lot better if you don't go there. (In fact I'd like the synchronisation point in Mongrel taken out because it causes unnecessary queueing problems if your server becomes overloaded).

That argument has kicked off again with a DHH post this morning and a response about why threads are vital to the future of Ruby and Rails.

Personally I like the quote from Professor Lee's 'The Problem with Threads' and I think it is highly appropriate to this debate.

... a folk definition of insanity is to do the same thing over and over again and to expect the results to be different. By this definition, we in fact require that programmers of multithreaded systems be insane. Were they sane, they could not understand their programs.