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!


  1. Actually, Django is having problems too with the 30 second timeout on initializing. At a Google App Engine internals talk I went to last week in Mountain View, someone asked Guido about that explicitly and he admitted to the problem and suggested hacking up the dependency graphs as one possible solution.

  2. 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.

  3. 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,

  4. 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.

  5. 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 :-)


Post a Comment

Popular posts from this blog

Custom built SBCL and using spaCy and TensorFlow in Common Lisp

I have tried to take advantage of extra time during the COVID-19 pandemic

GANs and other deep learning models for cooking recipes