Grails on Google App Engine – Part 5: Conclusion

October 17, 2010 at 5:12 pm | Posted in GAE, Grails, Groovy, Java, Web | 4 Comments
Tags: , , , , , , , ,

Thanks to the App Engine plugin you can get Grails running on App Engine. Yeah, you got your favorite web application framework deployed on the cloud. But wait…there’s a problem. Grails comes with a lot of libraries that are bundled with the framework. You got Spring, Hibernate, Sitemesh and all the other libraries you added to your application. This is how we’re used to build applications. However, building applications for Google App Engine is different. The platform puts your application into sleep mode when you don’t get enough traffic. This is understandable from Google’s view on scalability but not from a software developer standpoint. Calling the application after a period of no usage will reinitialize your classes, Spring application contexts and libraries. If the application cannot serve the request within 30 seconds the user will get a com.google.apphosting.api.DeadlineExceededException. The cold startup time will even be longer the bigger your WAR file is and the more libraries you use. This gets extremely painful with Grails. Sometimes you have to call your application three times in a row, run into an initialization error and try again until Grails can serve your request. Google was talking about “reserved instances” that would not put your application into sleep mode for paying customers. However, this has not been realized yet. The GAE/J forum is full of frustrated users complaining about this issue. You can work around the cold startup time by setting up a cron job in cron.xml that pings your application every minute. From an architectural view this not only is unnecessary and useless traffic for your application it also will not fully solve the problem. I still ran into issues with requests that couldn’t finish with the deadline time period.

<?xml version="1.0" encoding="UTF-8"?>
<cronentries>
   <cron>
      <url>/user/ping</url>
      <description>Keep the app alive by ping every 1 minutes</description>
      <schedule>every 1 minutes</schedule>
   </cron>
</cronentries>

Clearly, App Engine calls for a lightweight application framework until the cold startup issues have been resolved by Google in some sort of form. This puts Grails out of the running as a production-ready framework on App Engine. No company can afford exceptions being thrown on paying customers. This is not an issue solely to Grails. I am sure the startup times for full-fledged Spring applications on App Engine are not extremely better. An alternative for a Groovy-based web framework can be seen in Gaelyk. Gaelyk is not as feature-rich as Grails but will give you the benefit of faster startup times. Implementing non-trivial web applications with Gaeylk can be painful to develop because it’s not as feature-rich as Grails is. I guess in the end there’s always a tradeoff.

More on this topic:

Advertisements

4 Comments »

RSS feed for comments on this post. TrackBack URI

  1. […] Grails on Google App Engine – Part 5: Conclusion Possibly related posts: (automatically generated)Everything We Know So Far About Amazon’s Android App Store […]

  2. […] Grails on Google App Engine – Part 5: Conclusion […]

  3. Thank you very much for this great tutorial.

    I have one question : do you know which grails plugins are not compatible with GAE?
    Because I’ve heard that many plugins cannot work with App Engine and I just can’t live without some plugins (Searchable, Shiro, REST, App-Info…)

    • I don’t have a concrete list of plugins that will work on App Engine. Every plugin that only uses classes of the whitelist should work. Plugins that depend on Hibernate will definitely not work e.g. App-Info. The searchable plugin won’t work because Lucene is not supported on App Engine. Personally, I haven’t used any plugin on App Engine. My guess is that only a limited amount of the plugins will work.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.
Entries and comments feeds.

%d bloggers like this: