Search code examples
ruby-on-railsrubygoogle-app-enginejrubyjrubyonrails

What do I need to know about JRuby on Rails after developing RoR Apps?


I have done a few projects using Ruby on Rails. I am going to use JRuby on Rails and hosting it on GAE. In that case what are the stuff that I need to know while developing JRuby apps. I read that

  • JRuby has the same syntax
  • I can access Java libraries
  • JRuby does not have access to some gems/plugins
  • JRuby app would take some time to load for the first time, so I have to keep it alive by sending request every 5 mins or so
  • I cannot use ActiveRecord and instead I must DataMapper

Please correct if I am wrong about any of the statements I have made and Is there anything else that I must know?. Do I need to start reading about JRuby from the scratch or I can go about as usual developing Ruby apps?


Solution

  • I use JRuby everyday.

    True:

    • JRuby has the same syntax
    • JRuby does not have access to some gems/plugins
    • I can access Java libraries

    Some gems/plugins have jruby-specific versions, some don't work at all. In general, I have found few problems and as the libraries and platforms have matured a lot of the problems have gone away (JRuby has become a lot better).

    You can access Java, but in general why would you want to?

    False:

    • JRuby app would take some time to load for the first time, so I have to keep it alive by sending request every 5 mins or so
    • I cannot use ActiveRecord and instead I must DataMapper

    Although I guess it is possible to imagine a server setup where the initial startup/warmup cost of the JVM means you need to ping the server, there is nothing inherent in JRuby that makes this true. If you need to keep the server alive, you should look at your deployment environment. Something similar happens in shared-hosting with passenger where an app can go out of memory after a period of inactivity.

    Also, we use ActiveRecord with no problems at all.