May 20, 2007

Posted by John

Tagged presentation and railsconf

Older: Saturday: Keynotes

Newer: Sunday: Dave Thomas Keynote

Sunday: JRuby on Rails

By Charles Oliver Nutter and Thomas Enebo

jruby

  • ruby 1.8ish
  • a non-java language for the jvm
  • helping to expand ruby’s reach
  • helping the world better understand ruby

jruby is not

  • an attempt to polute or fork ruby
  • an admission that java sucks
  • the answer to every ruby problem
  • an attempt to alter ruby or add incompatible features
  • slow
  • obvious libs and gems preinstalled
    • rubygems
    • rake
    • rspec
  • mongrel supports jruby
  • rails just works
    • major orgs now investing in jruby on rails

justification

or dear god why would you do such a thing

  • supporting the status quo
    • jruby supports ruby 1.8’s string
    • jruby works with active support multibyte
  • exposing java unicode
    • java strings are all unicode and all libs are unicode friendly
  • ruby 2.0 string support on the way
  • jruby supports ruby’s thread api
    • even the ones we hate: kiill, raise
  • most jvms are native threaded

what’s the most cited pain point for rails?

the basics

  • most gems just work
    • rails
    • redcloth, bluecloth
    • hpricot
    • basically anything that is pure ruby
  • jruby script/generate controller test hello

a few things are different

1: database support

  • default pure ruby mysql and postgres work
  • has jdbc support which is different and fast but just as easy (jdbc:mysql in database.yml)
  • jndi for connection pooling
  • active record-jdbc doesn’t support all
    • jdbc has no schema management api
    • different databases quote differently
    • some databases are missing features
  • focused on databases close to rails
    • mysql, 100%
    • others at varying levels but coming along

2: no native extensions

  • some ports are done that work
    • mongrel and hpricot are done, rmagick in progress

3: command line performance

demo

  • jruby plugin called goldspike for creating wars
    • jruby -S rake war:standalone:create
  • there is a glassfish gem for deployment to run everything on the command line (much like mongrel, bug is that it doesn’t serve static files yet)

migration

  • it can be done, it’s basically ruby

database

  • mysql the best, oracle is being improved by community, not in CI
  • working well because they’re part of rails tests
  • tricky on some db’s that don’t have all features
  • fixtures working well

native extension issue

  • use something else
  • use an equivalent java library
  • port the library yourself
  • port by wrapping a java library
    • their favorite method, as it is the least work

deployment issue

  • mongrel
  • war file
    • multi-app, multi request concurrency
    • resource pooling
    • “good” java EE features
    • bound to monitoring of app server itself for tailing log files
  • grizzly/glasssfish v3 option
    • lightweight, gem installabe like mongrel
    • concurrency, etc.

beyond rails

  • calling java libraries from rail
    • this is really cool, you can code java and it looks just like ruby, auto getters and setters, so cool

3 Comments

  1. Outstanding write up. I haven’t been paying attention to jruby, but now I want to.

  2. I dont understand why there are so little effort on pgsql. Is mysql that much better

  3. For those who want to give JRuby a try, the BitNami team has released the JRubyStack. A very easy to use installer that provides JRuby, Rails, Java, Tomcat, GlassFish gem, MySQL and Subversion. We worked to make the deployment of Ruby apps on Tomcat and Glassfish as smooth as possible.

    JRubyStack is available for Windows, Linux and Mac OS X and you can download it from:
    http://bitnami.org/stack/jrubystack

    Thanks!

Sorry, comments are closed for this article to ease the burden of pruning spam.

About

Authored by John Nunemaker (Noo-neh-maker), a web developer and programmer who has fallen deeply in love with Ruby. More about John.

Syndication

Feed IconRailsTips Articles - An assortment of howto's and thoughts on Ruby and Rails.

Feed IconRails Quick Tips - Ruby and Rails related links.