Some frustration with JRuby + Rails on Google AppEngine

A few engineers at Google and other developers are doing some good work towards getting Rails running on AppEngine both robustly and in a way that provides a good local development environment. One problem is simply that if your web app is not active, initializing JRuby + Rails + and all required gems can time out (30 second window for handling requests).

The Java and Python support for AppEngine is fantastic, but for two projects I want to do (my own projects, but may be revenue generating :-) I want a more agile programming language that Java and while my Python skills are sort-of OK, my knowledge of Django is very light.

I should probably just bite the bullet and spin up on Django, but I would strongly prefer working in Ruby. I have been experimenting with the JRuby + Sinatra + ERB + datamapper combination and at least an inactive web application spins up well within the 30 second request timeout window. I very much like datamapper (object identity issues) and it should not be too difficult to be completely portable on two platforms (given data import/export utilities):
  • JRuby + AppEngine
  • Ruby (1.8.x or 1.9.x) on any server
I like Sinatra as a light weight framework, and this technology choice is OK with me, except for one worry: my reason for wanting to use AppEngine (rather that Amazon EC2+S3+EBS, which is what I have been using for most customer projects and my own stuff) is to minimize my hosting costs if one or both of my ideas works out - I worry that using JRuby on Java AppEngine will not provide the same high performance as Java or Python web apps. I did compare (using the Apache benchmark tool) request times for JRuby + Sinatra + AppEngine (about 400 milliseconds/request) with Java + JSP + AppEngine (about 600 milliseconds per request). The rendered Java page was more complex so the benchmark between JRuby + Sinatra vs. Java + JSP looks like a wash.

For future projects if I need lots of back end processing (map reduce, spidering sites, etc.) then I will stick with Amazon EC2. If I can get by with just a web interface and a data store, then I would prefer AppEngine (to save a little money). Two great platforms!

Comments

  1. It's also worth noting that there's a lot of work going on to speed up GAE/J that look like they'll get JRoR init times well under 30s. After that, improvements to RubyGems and JRuby can get it to a reasonable speed. It is definitely being addressed.

    ReplyDelete
  2. Hello Jay: that is good to know, thanks. I actually had a 30 second startup problem with a Java web app because it had to do some data initialization - I had to work around that.

    Hello Charles: long term, I am not worried about good JRoR support on AppEngine: I am sure that will happen. For now, JRuby + Sinatra + ERB + DataMapper is working well for me.

    Best regards,
    Mark

    ReplyDelete
  3. Merb + Sinatra + Data Mapper + eveny Pony (for email) are fine.

    But the need to install and compile 1 to 2 to 3 dozens of things, is a show-stopper for BOTH dabblers and old floks, or enterprisy guys like us.

    Let's cheer the gurus who are developing the code/plygins/bundlersetc for us.

    ReplyDelete
  4. George: I wrote this blog post a couple of months ago, but the situation for me is the same: no problems using Sinatra + Datamaper on AppEngine, but Rails still does not work well for me. That said both the ApEngine and JRuby teams are making continuous improvements - patience is good :-)

    ReplyDelete

Post a Comment

Popular posts from this blog

Ruby Sinatra web apps with background work threads

Time and Attention Fragmentation in Our Digital Lives

My Dad's work with Robert Oppenheimer and Edward Teller