Living on the Edge (of Rails) – the pilot

In: Edge Rails|Open Source|Ruby|Ruby on Rails

2 Jan 2008

Gregg Pollack of Rails Envy (the guys behind your favorite Ruby on Rails vs everything commercials) asked me recently whether I could provide them with weekly updates of changes on edge Rails for the Rails Envy Podcast (which is often hilarious besides being informative), seeing as I am already keeping up with developments on the Rails trunk while doing my small part contributing to Rails. Of course, I responded with a +1.

The podcast is now available and contains only abbreviated notes about the changes that I’d sent over to Gregg, so here’s the detailed version of changes on edge Rails from the release of Rails 2.0.2 (17 Dec 2007) to the day the podcast was recorded (30 Dec 2007).

Noteworthy changes on edge Rails: 2007-12-17 to 2007-12-30

Native mongrel handler

A native Mongrel handler has been introduced. This is so that it can be worked on independent of Mongrel‘s release cycle (the Rails handler is currently in the Mongrel codebase). Jeremy Kemper (bitsweat) has already made a minor performance improvement by moving the mutex from the handler itself into the dispatcher. This means that as Rails gets more threadsafe, the Rails team can push the mutex further down so that it’s not a (scary) giant lock (the existing Mongrel Rails handler has a synchronized block around Rails’ dispatcher).

Note: The native mongrel handler is not used by default at this time on edge Rails.

Caching branch for Rails 2.1

A caching branch has been introduced, targeted for Rails 2.1. Other than being a big refactoring, there’s also native cache key management (e.g. Product.find(5).cache_key # => "products/5") and memcache integration is also being looked at.

Ruby 1.9 compatibility continues…

Yup, work on Ruby 1.9 compatibility for Rails continues. Rails is fortunate to have committers and contributors who are so keen on being 1.9-compatible – free performance gains are hard to turn down after all. There’s been lots of patching going on to deal with the changes in Ruby 1.9 (Unicode changes, new syntax, deprecations, etc.).

Yes, the Rails committers and contributors working on 1.9-compatibility are fully aware that Ruby 1.9 is a development release, but nothing’s lost in making sure Rails is compatible with a version of Ruby that will eventually be a production version of Ruby. Besides, I think most of the 1.9-compatibility contributors have a dream that sometime soon, when Ruby 1.9 becomes “stable” enough, we’d be running our Rails applications on Ruby 1.9 for a free performance boost.

Too bad running Rails on Ruby 1.9 is not really possible at the moment since other projects like Mongrel need to be updated for Ruby 1.9 as well, first.

Bugfixes

  • The new TestCase subclasses (ActionController::TestCase,
    ActionMailer::TestCase) introduced in Rails 2 have a gotcha. This has been fixed quickly by Josh Peek.
  • Fixed a bug where trying to :include for a belongs_to association inferred the foreign key incorrectly from the class name, rather than from the association name (changeset contributed by Jonathan Viney). Code is probably easier to understand:
    class Post < ActiveRecord::Base
      belongs_to :main_category, :class_name => 'Category'
    end
    
    Post.find(:first, :include => :main_category)
    # => ActiveRecord::StatementInvalid: Mysql::Error: Unknown column
    'posts.category' in 'on clause'

Optimizations

I can has feedback nao plz?

Please leave any suggestions for improvements you may have – about anything really: format, level of detail, what you’d like to see, whatever. Until next week…

6 Responses to Living on the Edge (of Rails) – the pilot

Avatar

sho

January 2nd, 2008 at 8pm

Thanks for the runthrough! I think a lot of people are interested in Edge but simply don’t have time to trek through the trac to it explore it for themselves – very useful.

I’m very pleased to see the Core team so enthusiastic about performance these days. I guess it’s because Rails, while not “finished” as such, is certainly in a more stable cycle than it was even 6 months ago. Premature optimisation is a curse for sure, but it seems the time has come for some serious work to go into it now, and not a moment too soon.

This caching branch looks interesting and I’ll definitely be looking into it; especially plans to integrate Memcached somehow are intriguing. Like a lot of people I’ve written my own hacky caching system(s) and I’ll be glad to throw them away for something better…

Avatar

Michael Nutt

January 3rd, 2008 at 4am

A project I’m working on was just having discussions this morning about whether to track edge rails or stay with the stable release, so I think these blog entries will be a huge help. For people using edge, I think the most useful stuff to include will be the compatibility changes: deprecations, changes to defaults, etc.

I’m looking forward to reading your future posts. Keep up the good work.

Avatar

Ed Spencer

January 3rd, 2008 at 5am

This is brilliant, I used to subscribe to the trac feed but was annoyed by all the ‘noise’ of fairly minor things when all I wanted were the more important items. Ryan Daigle’s “What’s new in Edge Rails” are also excellent in this regard.

Avatar

A Fresh Cup » Blog Archive » Double Shot #116

January 3rd, 2008 at 8pm

[…] Living on the Edge (of Rails) – the pilot – Chu Yeow provides a summary of what’s changed in Edge Rails lately. This will be useful. […]

Avatar

A Crazy Agile Web Programmer’s Blog » Viviendo en el Edge: Piloto

May 13th, 2008 at 12am

[…] hace bastante me han ido llegando al Reader™ los cambios que se van incluyendo a lo último de Rails, cambios aún no […]

Avatar

puts Blog.new(”nonsense”) » Blog Archive » 5 Resources for Getting Up to Speed on Rails 2.1

July 8th, 2008 at 5pm

[…] #1 – native mongrel, caching, and Ruby 1.9 progress […]