Navigation

ADS specializes in using Ruby on Rails to build advanced, scalable, database-backed web sites for organizations of all sizes. Find out more at our website.

Atlantic Dominion Solutions

The first half of 2008 has seen a great number of happenings in the Ruby and Rails worlds. Here are the top ten for the first half of 2008.

  • June 23, 2008 - Rails scales - LinkedIn serves 1 billion pages using Rails
  • June 1, 2008 - Rails 2.1 is released
  • May 31, 2008 - Ruby 1.8.7 is released
  • May 30, 2008 - Joel Spolsky keynotes RailsConf 2008
  • May 30, 2008 - FiveRuns released TuneUp to help with Rails performance optimization
  • May 27, 2008 - JRuby 1.1.2 is released, and runs Rails 2.1 like a champ
  • April 13, 2008 - Phusion Passenger (mod_rails) is released
  • April 11, 2008 - Rails core moves to Github, prompting many to move with them
  • April 2, 2008 - Morph Labs makes Rails deployments to EC2 a cinch
  • January 1, 2008 - Thin comes on the scene as an alternative to Mongrel

See something I missed? Drop us a comment below.

Share this post

Installing the JDK 1.6 on Mac OS X

By: Robert Dempsey | Tags:

In my last post, Create and Deploy a JRuby app to the GlassFish gem in 10 minutes or less on Mac OS X, I mentioned using the JDK 1.6 (a.k.a. SoyLatte) to get the performance benefits from JRuby 1.1 RC2. Installing it is a snap, no compiling necessary. Here is what to do:

  • Download SoyLatte 1.0.2 for Mac OS X 10.4 and 10.5. For authentication use username: jrl, password: I am a Licensee in good standing
  • Unzip the package and put the entire directory where you want it
  • Optional: rename the folder to soylatte16-1.0.2
  • Add the soylatte16-1.0.2/bin path to your $PATH variable to use soylatte rather than the JDK 1.5 that comes installed
  • Fire up a terminal session and type “java -version

If everything worked out, you should see something similar to:

java version "1.6.0_03-p3"
Java(TM) SE Runtime Environment (build 1.6.0_03-p3-landonf_03_feb_2008_02_12-b00)
Java HotSpot(TM) Server VM (build 1.6.0_03-p3-landonf_03_feb_2008_02_12-b00, mixed mode)

Enjoy the performance!

Connect with me on LinkedIn, Twitter, or recommend me on Working With Rails.

Share this post

The JRuby and Glassfish teams have made installing, building, and launching a JRuby on Rails app a rather trivial process. Glassfish, a Java app server, has been reduced in size from a 22.5 MB install to 2.5 MB Ruby gem (not too shabby for a full app server). If you need the full monty (not covered here) or you need to deploy to another Java app server, install the warbler gem. The combination of Rails 2.0.2 (stable), JRuby 1.1 RC2, the Glassfish gem, and JDK 1.6 is not only breaking down enterprise barriers but speeding up apps all over the place.

So how do we get started with all this, in 10 minutes or less? Let’s take a look.

Overview
Here are the steps we will take to build our first JRuby on Rails application:

  • Download and install JRuby
  • Install Rails and the dependent gems
  • Install the Open-SSL gem
  • Install the GlassFish gem
  • Create a test JRuby on Rails app
  • Deploy our little app to the GlassFish gem

“Make it so Number 1″

First, download JRuby 1.1 RC2. Unpack it into a directory and edit your bash_profile to include the bin directory in your $PATH so you can easily call JRuby executables. Mine looks like this: /Users/rdempsey/Documents/jruby/jruby-1.1RC2/bin. Open up a terminal session and type jruby –version to see if you are successful. If you are, you should see something like this:

$ jruby --version
ruby 1.8.6 (2008-02-16 rev 5944) [i386-jruby1.1RC2]

Now that JRuby is installed (and yes, ready to go), let’s install Rails:

$ jruby -S gem install rails --no-ri --no-rdoc
Successfully installed activesupport-2.0.2
Successfully installed activerecord-2.0.2
Successfully installed actionpack-2.0.2
Successfully installed actionmailer-2.0.2
Successfully installed activeresource-2.0.2
Successfully installed rails-2.0.2
6 gems installed

For full SSL support (and why not have it) install the jruby-openssl gem too.

$ jruby -S gem install jruby-openssl --no-ri --no-rdoc
Successfully installed jruby-openssl-0.1.1
1 gem installed

Now for the Glassfish gem. One command should get us going.

$ jruby -S gem install glassfish
Successfully installed glassfish-0.1.1-universal-java
1 gem installed

Great. How are we on time? 8 minutes to go? Perfect. Let’s create our test Rails app.

$ jruby -S rails --database mysql testapp
... Rails code being generated ...

Change into the directory of testapp and fire up your favorite editor. I like TextMate, though the new NetBeans is looking HOT. Once inside, open up config/database.yml and change the username/password for your MySQL server as necessary. In your terminal and in the root of your app, run the following rake command to create the development database:

$ rake db:create

It may not seem like anything happened, but if you fire up your MySQL gui tool of choice (or go command line) you will see that the testapp_development database has been created. Now to create a migration and test things out. Let’s make a widget.

$ script/generate scaffold Widget name:string description:text
      exists  app/models/
      exists  app/controllers/
      exists  app/helpers/
      create  app/views/widgets
      exists  app/views/layouts/
      exists  test/functional/
      exists  test/unit/
      create  app/views/widgets/index.html.erb
      create  app/views/widgets/show.html.erb
      create  app/views/widgets/new.html.erb
      create  app/views/widgets/edit.html.erb
      create  app/views/layouts/widgets.html.erb
      create  public/stylesheets/scaffold.css
  dependency  model
      exists    app/models/
      exists    test/unit/
      exists    test/fixtures/
      create    app/models/widget.rb
      create    test/unit/widget_test.rb
      create    test/fixtures/widgets.yml
      create    db/migrate
      create    db/migrate/001_create_widgets.rb
      create  app/controllers/widgets_controller.rb
      create  test/functional/widgets_controller_test.rb
      create  app/helpers/widgets_helper.rb
       route  map.resources :widgets

With Rails 2.0.2 we don’t have to specify the timestamp fields, those are automatically added to the migration. Now, run “rake db:migrate” to add your database table.

$ rake db:migrate
(in /Users/rdempsey/Documents/jruby/testapp)
== 1 CreateWidgets: migrating =================================================
-- create_table(:widgets)
   -> 0.4622s
== 1 CreateWidgets: migrated (0.4624s) ========================================

And now for the fun part, deploying the app to the GlassFish gem. Change to the parent directory of your application (getting out of the root directory) and run the following command:

$ jruby -S glassfish_rails testapp
Feb 18, 2008 5:03:00 PM com.sun.enterprise.v3.server.AppServerStartup run
... GlassFish firing up...
INFO: Loading application testapp at /
Starting Rails instances
... Rails instantiation info...
INFO: Glassfish v3 started in 24766 ms

As with Mongrel, the GlassFish gem starts our server on port 3000. Fire up your browser and go to http://localhost:3000/widgets and play around.

JRuby on Rails app

Pretty nice eh? Looks like we have time to spare as well. Go make yourself that next pot of coffee and see what else you can do with this new found power. Let us know how things turn out as well.

Connect with me on LinkedIn, Twitter, or recommend me on Working With Rails.

Share this post

JRuby 1.1 RC2 Released

By: Robert Dempsey | Tags:

Thomas Enebo announced the release of JRuby 1.1 RC2 this past Saturday. The focus of the release is improved speed and refinement. He also says that RC2 uses less memory, and can compile in either Ahead of Time (AIT) or Just In Time JIT) mode. Charles Nutter then followed up with a post of his own letting us know what is next on the agenda for the JRuby team.

They are asking for you to download RC2 and provide feedback.

If you’ve used JRuby, let us know about your experience.

Connect with me on LinkedIn, Twitter, or recommend me on Working With Rails.

Share this post

JRuby 1.0.2 Released

By: Robert Dempsey | Tags:

The JRuby team announced that they have released version 1.0.2 which includes fixes for Windows users, support for Rails 1.2.5, 99 total resolved issues since 1.0.1, and more. These guys are busy! Grab the latest on the JRuby site and get integrating.

Share this post

Thank God for a continuous flow of coffee and multiple cafe’s on every block. I love Berlin! Things are as hectic today as they have been everyday.

The second half of this morning brought a talk on JRuby from Ola Bini, one of the JRuby development team. Ola’s presentation had a lot of material, so allow me to summarize:

What’s wrong with Ruby today?

  • Green threading
  • Partial Unicode support
  • Speed (slow)
  • Memory management, specifically the garbage collector
  • C language extensions
  • Politics (you want me to switch to what?)
  • Legacy (Java is everywhere)

What is JRuby?

  • Java implementation of Ruby
  • At version 1.0.1
  • Based on Ruby 1.8.5
  • 6 core developers, open source, close to 40 contributors
  • Commercial backing from Sun and ThoughtWorks

What can JRuby do?

  • All ?��Ǩ?�pure Ruby?��Ǩ�� code works (with some caveats)
  • Rake and rubyGems run well
  • Rails works almost perfectly

What can’t JRuby do?

  • Deterministic threading
  • Continuations
  • Some file system operations
  • Forking, and other POSIX ilk

So, how does JRuby solve the stated problems with Ruby?

  • Native threading
  • Scaling across processors and cores
  • Concurrent execution
  • Thread scheduling
  • No politics - just another Java library

What challenges does JRuby face?

  • Performance of unit tests
  • It’s not “free” to run both JRuby and MRI (Matz’s interpreter)
  • Start-up time (especially with Rails)
  • JRuby regular expressions have different performance characteristics
  • YAML isn’t stable yet
  • High memory consumption (but still less than Mongrel)
  • Good replacement for RMagick is needed
  • Lack of documentation

It was a great session with a lot of information. Hopefully Ola will have his slides posted to the RailsConf Europe site.

Share this post

The JRuby team released version 1.0.1 yesterday along with the plan for version 1.1, which is to be released before RubyConf in early November.

The 1.0.1 maintenance release:

  • Resolves 28 issues
  • Fixes multipart processing
  • Fixes sockets that affected some of the net/* libraries
  • Fixes network timeouts when using large packets

Per a message from Charles Nutter, the 1.1 plan includes:

  • Compiler complete
  • AOT compilation working with jrubyc
  • stdlib all precompiled
  • gem install precompilation
  • virtual filesystem-inside-JVM (maybe) or hacked rubygems that can run out of an archive
  • performance improvement to be quantified…java integration, execution, memory reduction
  • yarv bytecode execution and compilation (maybe)
  • AST sharing as an option (sharing across runtimes)…need to explore AOT compilation and its (positive?) effect on memory too
  • real threading brutalization, testably multithread-safe core classes (maybe, needs heavy testing on many-core systems)
  • Java API rubification, perhaps with require ‘javax.swing’ and so on

Grab the release and start deploying Rails apps in your Java environment.

Share this post

Someone told me that watching a video is more fun that reading something. So much for the library I have sitting here then. However, in that spirit, we are happy to release the first in a series of screencast tutorials. We are starting out with JRuby. In this screencast, we took the first of our JRuby tutorials and made it happen. There is much more to come so stay tuned, and if you like it, let us know. As for me, time for bed.

If that doesn’t work for you…

Google Video has been having issues with the screencast for some reason, and it is too long for YouTube (13.5 minutes). So, just in case, we uploaded the file to our site. It weighs in at 40 MB. You can grab it from here.

Share this post

Peter Cooper Launches JRuby Inside

By: Robert Dempsey | Tags:

Peter Cooper launched JRuby Inside on Sunday - very cool. It’s like Ruby Inside for JRuby he tells us. Check it out.

Share this post

What happens when you throw a couple newly-forged step siblings together and tell them to get along? You might see a little of the interaction like what we’ve been seeing between Java users and Ruby users lately — a little tete-a-tete back and forth about who is better because they’re bigger and older and well established, and who’s better because they’re small and fast. But at the end of the day, they simmer down and realize that they get a lot more done if they just work together.

All programming languages are really just tools with which you write software. The mark of any good tool is the level of transparency it attains while being used. The less time you spend thinking about how your tool works and the more time spent on creating something with it, the better it is. This is one reason why Ruby is so attractive — because it’s considered a natural language programming language, and it is (relatively) easy to understand, even for the non-programmer.

That being said, there is a balance between ease of use and power of the tool when used at a more proficient level. Here is where Java has excelled. It has been in use for quite some time, and in that time has been improved, amended, and built upon to create large and complex systems.

Now, don’t think I’m saying Ruby or Rails are lightweights, or won’t be able to achieve the same power. Rails is *new* and has brought more attention to Ruby. With any new or emerging technology, it takes time for the collective user base to start to realize just what can be done with that tool. What comes first are the questions of how it can better solve existing problems. Next, as challenges are solved, a new perspective is gained. We can then use that new perspective to cast light on both existing and emerging challenges. It is then that we start to see the real power of that tool/technology/language, and what it can accomplish.

So what I’m getting to is this: there is no single, all-powerful tool which will solve all problems, all the time. New issues are continually emerging which require new perspectives. What we need to do is break out of our sandbox, and join our neighbors to build better castles. Perhaps JRuby is the bridge between Ruby and Java that will do just that. Why choose when we can work together? This, my friends, is what programming is about.

Happy coding!

- Naomi Butterfield

Share this post