4. Key Features
• No need to install or maintain your own stack
• Use Google scalable services via standard APIs
• Built-in application management console
• Google does the scaling for you
• Pay-as-you-go, with free quota to get started
4
Wednesday, May 5, 2010
5. Quotas and Billing
Resource Provided Free Additional Cost
CPU time 6.5 hours/day $0.10/hour
Bandwidth In 1GByte/day $0.10/GByte
Bandwidth Out 1GByte/day $0.12/GByte
Stored Data 1 GB $0.005/GB-day
Emails sent 2000/day to users $0.0001/email
50000/day to admins
6
Wednesday, May 5, 2010
6. Key Limitations
• No native code
• No threads or sockets
• No writing to the filesystem
• No relational database
• No more than 30 seconds per request
7
Wednesday, May 5, 2010
8. Current Issues with JRuby on App Engine
• Several seconds to “spin-up” a new JRuby instance
• Some gems still need their extensions ported to Java
• Not officially supported, but you have all that you need
+
9
Wednesday, May 5, 2010
10. Dev AppServer
• Local implementation of services
– LRU memcache
– Disk-backed datastore
– HttpClient-backed URLFetch
• Emulates the production environment
– Sandbox restrictions may be inconsistent,
so run tests on production servers as well
11
Wednesday, May 5, 2010
11. Deployment
• Your app lives at
– <app_id>.appspot.com, or
– Custom domain with Google Apps
• Deploying uploads
– Static files
– Resource files
– Other metadata (datastore indexes, cron jobs)
• Admin Console
– dashboards
– manage multiple versions
– view logs
12
Wednesday, May 5, 2010
13. Users API
• Existing User Account
• Restrict your app to a domain
map '/src' do
use AppEngine::Rack::AdminRequired
use AppEngine::Rack::SSLRequired
run ActionController::Dispatcher.new
end
map '/' do
run ActionController::Dispatcher.new
end
14
Wednesday, May 5, 2010
14. Datastore API + DataMapper
# Comparisons you’d expect
Zoo.first(:name => 'Galveston')
# The 'gt/lt' means greater/less-than.
Person.all(:age.gt => 30)
Person.all(:age.lt => 40)
# The 'gte/lte' means greather/less-than-or-equal-to.
Person.all(:age.gte => 30)
Person.all(:age.lte => 40)
# The value of a pair is an Array
Person.all(:name => 'Sam', :id => [ 1, 2, 3, 4, 5 ])
Person.all(:name => [ 'bob', 'rick', 'steve' ])
# Ordering
Person.all(:order => [ :age.desc ])
15
Wednesday, May 5, 2010
15. Memcache API
• No configuration required
• Same API as Ruby-Memcache
• Keys can be any Symbol or String
• Can store any Marshalable or Serializable object
cache = AppEngine::Memcache.new
cache.set_many({:a => 1, :foo => 1..5})
a, foo = cache.get(:a, :foo)
16
Wednesday, May 5, 2010
16. URL Fetch API
• Drop-in replacement for Net::HTTP
AppEngine::URLFetch.fetch(url, options={})
:method
:payload
:headers
:allow_truncated
:follow_redirects
:deadline
17
Wednesday, May 5, 2010
18. App Engine JRuby Milestones
• 2009-04-07 Early look at Java
• 2009-04-08 @olabini publishes blog post on YARBL
• 2009-05-06 RailsConf (Sinatra Demo)
• 2009-11-02 0.0.5 bundler, precompilation & Duby
• 2009-11-20 RubyConf (Rails 3 Demo)
• 2009-12-02 0.0.6 Image manipulation examples
• 2010-01-21 0.0.8 Rails 2.3.5 Primer for DM & TinyDS
• 2010-01-26 0.0.9 Mechanize and Hpricot examples
• 2010-02-19 @carlhuda publishes bundler08
• 2010-02-27 0.0.10 ActionMailer example
• 2010-04-08 0.0.11 Deferred Dispatcher (early look)
• 2010-05-05 0.0.12 JRuby 1.5.0.dev (jruby-openssl)
19
Wednesday, May 5, 2010
19. App Engine Product Roadmap
• SSL for third-party domains
• Background servers capable of running for longer than 30s
• Ability to reserve instances to reduce application loading overhead
• Ability to select different availability vs. latency options for Datastore
• Support for mapping operations across datasets
• Datastore dump and restore facility
• Raise request/response size limits for some APIs
• Improved monitoring and alerting of application serving
• Support for Browser Push (Comet) communication
• Built-in support for OAuth & OpenID
20
Wednesday, May 5, 2010
20. Resources
• John Woodell, woodie@google.com
• Twitter, @johnwoodell
• Blog: JRuby on App Engine Blog
– http://jruby-appengine.blogspot.com/
• Google App Engine for JRuby
– http://code.google.com/p/appengine-jruby/
• Google Group
– http://groups.google.com/group/appengine-jruby
21
Wednesday, May 5, 2010
21. Bio
• John Wang
iPhone, Android, and Web Developer at Fresh Blocks in Honolulu, HI
Twitter: @johntwang
Github: jwang
• Objective
I wanted to show that JRuby on GAE is a viable solution for
providing RESTful JSON with Google’s Datastore to iPhone and
Android apps.
Tuesday, May 4, 2010
22. My App
• iPhone-JSON is a demo app used to show
that AppEngine with Rails 2.3.5 is fully
capable of being a RESTful provider with
DataMapper.
• It is currently up and running on iphone-
json.appspot.com for others to copy.
• It is also serving as the datastore for an
iPhone and an iPad App that are awaiting
approval from Apple.
Tuesday, May 4, 2010
23. What I Learned
• When I started out, I knew I would have to use the DM-Serializer
plugin to add back in the RESTful abilities to DM. I did not expect
the JSON being POSTed to be case-sensitive for the parameters.
• There was a small bug in the DM adapter that was causing
problems initially, but that was remedied very quickly thanks to
John.
• I did need to add in the necessary render statements to each area in
the generated responds_to and was also able to get custom REST
actions to work without any problems.
• Most 3rd Party gems come with scripts to generate models, tables,
etc take for work as scripts are written for ActiveRecord and not
DataMapper. I needed to modify some scripts for other 3-party
gems. Primarily the ones I’m using for doing Push Notifications to
the iPhone from GAE.
Tuesday, May 4, 2010
28. MYSELF
• Joshua Moore, Quality • Find me here:
Assurance Manger at
Armorize Technologies • Twitter: @codingforrent
• Wanted to develop apps • github: http://github.com/
with Rails without the pains joshsmoore
of being a sys admin so
started to work with Rails • blog:
on the GAE www.codingforrent.com
Monday, May 3, 2010
29. MY APP
• Rails Turbine - Goal to be a no config drop in blog engine for
built with Rails on the GAE (still a work in progress).
• Open source on github
• Built with Rails 2.3.5, Datamapper, and HAML
• Coauthor the rails_dm_datastore gem to fix some rails/dm
bugs
• Currently it powers my blog (www.codingforrent.com)
Monday, May 3, 2010
30. ROAD BLOCKS
• Initiallyhad some bugs with datamapper and rails not always
playing nice together. Most of those are worked out in the
rails_dm_datastore.
• The next biggest problem has been testing. It can be difficult
and sometimes unreliable for testing within the Datastore
environment.
Monday, May 3, 2010