Phusion white papers Phusion overview

Getting ready for Ruby 1.9.1

By Hongli Lai on February 2nd, 2009

We are excited about Ruby 1.9.1. Of course, with all the performance improvements, who wouldn’t be? Unfortunately a large number of Ruby libraries and extensions still don’t work on 1.9.1, so Ruby 1.9 cannot be considered production-ready yet. Ryan Bigg has done an excellent job on documenting most of the problems that one would encounter when trying to get a basic Rails app up-and-running on Ruby 1.9.1. Basically, the problems he countered were:

  • 2.2.2 isn’t compatible with 1.9.1. Use Rails 2.3.0 RC1 or Rails edge.
  • The mysql gem needs patching.
  • The hpricot gem needs patching.
  • The postgres gem needs patching.
  • Thin needs patching.
  • The fastthread gem needs patching.
  • Mongrel needs patching.

But what about Phusion Passenger? Good news:
Phusion Passenger is Ruby 1.9.1-compatible since this commit (today).

Here’s a screenshot of a Rails 2.3.0 app running in Phusion Passenger on Ruby 1.9.1:

passenger-ruby19

Do you see the changes? Me neither. That’s the point. :)

We’ve encountered the following issues upon trying to get a simple Rails 2.3 app up running with Phusion Passenger and Ruby 1.9.1:

Fastthread isn’t compatible with 1.9
Both Mongrel and Phusion Passenger depend on Fastthread, which is a threading library that fixes some threading implementation bugs in older versions of Ruby 1.8. Fastthread is only a required dependency when running on older versions of Ruby 1.8. Unfortunately there’s no way to tell RubyGems “we depend on fastthread, but only when running on older versions of Ruby 1.8, and not on JRuby”.

Fastthread doesn’t compile on Ruby 1.9 (or on JRuby or other Ruby implementations for that matter), so when you type “gem install passenger” or “gem install mongrel” on Ruby 1.9, the installation fails with a ton of compile errors.

We’ve patched fastthread so that it becomes a no-op on Ruby 1.9.1 and on JRuby (that is, fastthread will install correctly but it won’t do anything). These patches have been submitted to Mentalguy, the maintainer of fastthread.

The sqlite3-ruby gem doesn’t work on 1.9
Jeremy Kemper submitted a 1.9 compatibility patch in the past, which had been committed. Unfortunately even with this patch, sqlite3-ruby isn’t compatible with 1.9.1.

We’ve gone ahead and fixed 1.9.1 support. The patch can be found here: http://rubyforge.org/tracker/index.php?func=detail&aid=23792&group_id=254&atid=1045

Hongli Lai Ninh Bui
  • http://attilagyorffy.com Attila Györffy

    It’s always good to see the Ruby community evolving and Passenger have never been an exception. Well done guys, I’m sure this change will make a huge difference. Passenger <3

  • http://blog.zerosum.org nap

    Nice work. Thanks guys.

  • http://pragmatig.wordpress.com grosser

    great news & good work!

    hopefully we can switch to 1.9 soon…

  • http://rubylicio.us/ rubylicio.us

    This is great news, I refuse to deploy with anything other then passenger!

  • Hunter

    Does ruby 1.9.1 offer any memory benefits when using Passenger? REE gets benefit from CoW, etc. Out of the box will Ruby 1.9.1 get anything like this or might there be a REE 1.9.1?

  • http://www.phusion.nl/ hongli

    @Hunter: Ruby 1.9.1’s garbage collector is not copy-on-write friendly, so no.

  • http://www.phusion.nl/ hongli

    WordPress’s admin interface is malfunctioning. Kyle said:

    @hongli: no benefits out of the box, or no REE 1.9?

    The answer is: no benefits out of the box.

  • Mathijs

    Will there be a way to run some sites on 1.9 and some sites on 1.8?

    I would like to have
    /opt/ruby-enterprise-1.8-20090129
    /opt/ruby-enterprise-1.9-20090129

    and configure passenger on a per-site basis which one to use.
    Will this be possible or do I need a separate (virtual) machine for this?

    Thanks!

  • http://www.phusion.nl/ hongli

    Matthijs: You don’t need seperate virtual machines, you just need seperate Apache instances, one running Ruby 1.8 and one running Ruby 1.9. Put both Apaches behind a single reverse proxy or load balancer if you want them to be accessible from the same IP+port.

  • Pingback: The Life Of A Radar » Blog Archive » Ruby 1.9.1 & Friends()

  • Pingback: Double Shot #383 « A Fresh Cup()

  • http://sanbit.com sanbit

    Great job!!!
    So in terms of speed and performance, is it better to go with ree or ruby 1.9.1? I would think that using ruby 1.9.1 is probably more efficient/faster.

  • http://www.phusion.nl/ hongli

    1.9.1 is faster.

  • http://www.railscluster.nl Roderick van Domburg

    Are you planning on a REE version of 1.9 and 2.0? Certainly the COW and tcmalloc features would be great additions.

  • http://www.railscluster.nl Roderick van Domburg

    Just in case you missed it, nobu has added a couple of interesting comments to the commit on GitHub.

  • Pingback: 23 links e recursos úteis do Ruby 1.9()

  • Pingback: Ruby 1.9.1 Library Compatibility Roundup | Xingyu.zhang's Technology Circle()

  • Pingback: 23 Useful Ruby 1.9 Links and Resources « A little story()

  • http://www.phusion.nl/ hongli

    @Roderick: We plan on porting the functionality to the 1.9 series in the long term.

    Github disabled the comments feed, so I can’t find nobu’s comment. Could you provide a link?

  • http://www.nedforce.nl Roderick van Domburg
  • Pingback: Listão de links sobre Ruby 1.9 | Ruby Brasil()

  • http://www.brainbankhq.com BrainBank

    Sweet! I’m going to try this out next weekend on a new slice and see how it goes. Hopefully people start making their gems 1.9.1 compatible in a hurry. Thanks for the amazing work Hongli and team!

    ~ Mel

  • http://botandrose.com Micah Geisel

    with 1.9.1’s native threading, what happens when you enable config.threadsafe! in production.rb and fire up passenger? dare i dream?

  • Pingback: 23 Useful Ruby 1.9 Links and Resources()

  • Pingback: Phusion Passenger 2.1.1 (beta) released, thanks sponsors! « Phusion Corporate Blog()

  • http://walter.schreppers.com Walter Schreppers

    Hi,

    Well wanted to announce that latest passenger and ruby 1.9.1 is not working for me.
    Without passenger I have a simple scaffolded app running here (regular script/mongrel)
    http://85.10.204.201:3000/books

    With passenger, same app, same environment/server/database only now passenger serves the app and it runs here:
    http://85.10.204.201/books -> crashes on destroy, delete, update actions (which are just default scaffolded actions).

    I don’t seem to get answers on my ticket about this so might as well post it here.
    Hope u can fix this soon cause I love passenger+rails ;) It basically gives me a 500 error and nothing is stated in apache logs nor development.log cause the app is just killed by passenger whenever it tries to write to database (or is it a session/cookies issue?).

    Kind regards,
    W.

  • http://freewardchoir.musicformormons.com roger

    Any hope for REE 1.9 anytime soon? (tcmalloc, COW GC, et. al)