views:

73

answers:

2

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?

+2  A: 

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.

Toby Hede
Thanks for the answer. I have one more question. JRuby is an implementation of Ruby 1.8.7, which had performance problems. Could you please tell me, does JRuby has any problems like that?
Felix
Some of the 1.8.x performance stuff relates to thread and GIL in the Ruby VM. JRuby doesn't have these issues because it relies on the JVM and the JVM threading model. In general the performance profile is completely different.
Toby Hede
Thanks toby :).
Felix
+1  A: 

afaik, rails 3 is 100% compatible with jruby, so there should be no problem on that path.

like every new platform, you should make yourself comfortable with it by playing around with jruby. i recommend using RVM to do that.

as far as you questions go:

  • JRuby is just an other runtime like MRI or Rubinus
  • since JRuby is within the JVM using Java is very easy, but you can also use RJB from MRI
  • some gems are not compatible, when they use native c libraries, that do not run on JRuby
  • the JVM and your application container need startup time and some time to load your app, but that is all, there is no need for keep alive, that is wrong
  • you can use whatever you want, most gems are updated to be compatible with JRuby
phoet
Thanks for your answer :)
Felix