Redfin November 14, 2008
Posted by wannamakemoney in : Uncategorized , trackbackRuby on Rails causes Global Warming
I use a laptop. Which means, as I peck away at my keyboard in the waning hours of the evening, I can smell the slow charring of my wool pants (mixed with the redolent odor of singed leg hair) as the tiny fan embedded in my computer tries desperately to keep this multi-thousand-dollar device, from melting into a pile of slag.
As a self-taught engineer, I tend to notice the glaringly-obvious - perhaps more than many of my well-educated peers. And there’s one obvious lesson in this - if solid state electronics are getting HOT, they’re wasting using a fair amount of power.

in a atomic reactor somewhere out there, an atom died for the pixels on my screen. another occasional drops of costly oil, or a few tons more gasified coal, were spilt for those extra minutes of microsoft briefly (or perhaps “notable pilfering auto 4″).
Moore’s Law has shown us how the steady change of computing SPEED (doubling), and COST (halving), has reliably powered our advancing Information Age. Yet nothing in Moore’s Law has halted the seemingly inexorable increase in ENERGY requirements, of these most devious of machines.
This is not a problem that we’ve address head on - in our subsidized energy economy, there has been no real motivation to do so. In fact, as our dependency on computing infrastructure has deepened, we’ve made it WORSE. Here’s how it works:
“Hey Jim, did you realize that these hard drives fail as they get older? And really reliable hard drives are WAY more expensive.”
“Wow! That SUCKS! Why don’t we just put TWO hard drives in every computer, and copy all the data to BOTH of them?”
No joke. We’ve also done the same thing with (redundant) power supplies, and since all these extra disks and transformers are putting out more HEAT - we’ve had to install more AIR CONDITIONING, too. Oh, and in the REALLY high-end data centers, we’ve got at least one (sometimes two or more) Diesel Generators running at all times - just in CASE the power goes out.
As is typical of the world’s larger problems, the smartest folks haven’t done better - they’ve just done WORSE… in a more complicated way. Let’s take a look at programmers.
Writing software has changed a lot since we started this business. We’ve drifted from the “low-level” languages, up through the “high-level” languages, to things now rightly called “frameworks” that are too abstracted to be considered a language at all.
But along the way (with all this gratuitous computing power sitting around), we’ve gotten UNBELIEVABLY lazy. Here’s an example - it is, by no means, the only one:
Ruby on Rails. A very popular framework, with some fairly typical problems.
Ruby is not, to start with, an efficient language. This means it doesn’t do a very good job of translating “high-level” code, into “low-level” machine code.

rails, as a framework, is intended to be really easy to use. which means it does a lot of equipment for you - much of which you don’t actually need done, in any given container.
Rails uses a database access pattern called “Active Record”. It’s pretty cool, actually - it encapsulates about 10 layers of abstraction, into a few easy-to-use commands.
Unfortunately, that encapsulation ignores most performance impacts. Also unfortunately, the implementation of that pattern - is not thread-safe.
Here’s where the laziness kicks in - rather than fixing the ActiveRecord implementation, or making ruby more efficient in general, someone wrote Mongrel.
What’s Mongrel? An extra web-serving layer, it simply manages a bunch of ruby instances, and hands http requests back and forth. It’s a workaround for the thread-safety problems we were mentioning above.
In software development, it’s called a “Kludge”. In human society, it’s called a “Rat Race”. (We all drive SUVs, even when we object to them environmentally, because we need to be safe - safe in case someone ELSE driving an SUV crashes INTO us. Are you starting to appreciate the irony?)
“So what,” I can hear you saying, “Buying more hardware is cheaper than fixing a whole langu …
Related posts: Newsminer, Arena football, Cricket score, Is the stock market open on veterans day, Musical road
Comments»
[…] posts: Redfin, Commentary: McCain as Obama’s new friend?, Iposture, Arena football, Popcorn […]
[…] posts: Redfin, Veterans day postal service, Prosecutor asks to drop charge against boy, 8, Traducteur espagnol […]