Wednesday, November 25, 2009
JRuby on Google App Engine
           Extending the Java Platform & APIs
           John Woodell
           Nov 27, 2009

...
What is Google App Engine?
           • A cloud-computing platform
           • We provide the container and services
    ...
WhiteHouse.gov/openforquestions




             4



Wednesday, November 25, 2009
Quotas and Billing
                   Resource        Provided Free      Additional Cost
                   CPU time      ...
JRuby on App Engine
             6



Wednesday, November 25, 2009
Current Issues with JRuby on App Engine
           • Several seconds to “spin-up” a new JRuby instance
           • Some g...
$ sudo gem install google-appengine
           Successfully installed appengine-rack-0.0.4
           Successfully install...
App Engine Gems
           • Development Gems
             – appengine-rack
             – appengine-tools      dev_appser...
Dev AppServer
           • Customized Jetty server
           • Local implementation of services
                 – LRU me...
Deployment
           • Your app lives at
             – <app_id>.appspot.com, or
             – Custom domain with Google...
App Engine JRuby APIs
           • AppEngine::Users
           • AppEngine::Datastore
           • AppEngine::Memcache
   ...
Users API
           • Existing User Account
           • Restrict your app to a domain


          map '/src' do
        ...
XMPP API




            14



Wednesday, November 25, 2009
Memcache API
           • No configuration required
           • Same API as Ruby-Memcache
           • Keys can be any Sy...
URL Fetch API
           • Drop-in replacement for Net::HTTP


          AppEngine::URLFetch.fetch(url, options={})

     ...
Small & Modular Frameworks
           • Rack
           • Sinatra
           • Merb/Rails3*
           • Duby




        ...
DataMapper Finders
          # Comparisons you’d expect
          Zoo.first(:name => 'Galveston')

          # The 'gt/lt'...
DataMapper Associations
           • has n, has 1
           • belongs_to, many_to_one

          class Post
          inc...
Demo



Wednesday, November 25, 2009
Resources
           • John Woodell, woodie@google.com
           • Google App Engine for JRuby
                 – http://...
Wednesday, November 25, 2009
Upcoming SlideShare
Loading in …5
×

JRubyConf 2009

1,821 views

Published on

JRuby on Google App Engine

Extending the Java Platform & APIs

2009-11-27

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,821
On SlideShare
0
From Embeds
0
Number of Embeds
10
Actions
Shares
0
Downloads
0
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

JRubyConf 2009

  1. 1. Wednesday, November 25, 2009
  2. 2. JRuby on Google App Engine Extending the Java Platform & APIs John Woodell Nov 27, 2009 2 Wednesday, November 25, 2009
  3. 3. What is Google App Engine? • A cloud-computing platform • We provide the container and services • Run your web apps on Google’s infrastructure • Pay-as-you-go, with free quota to get started 3 Wednesday, November 25, 2009
  4. 4. WhiteHouse.gov/openforquestions 4 Wednesday, November 25, 2009
  5. 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 5 Wednesday, November 25, 2009
  6. 6. JRuby on App Engine 6 Wednesday, November 25, 2009
  7. 7. 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 + = ? 7 Wednesday, November 25, 2009
  8. 8. $ sudo gem install google-appengine Successfully installed appengine-rack-0.0.4 Successfully installed appengine-jruby-jars-0.0.6 Successfully installed appengine-sdk-1.2.6 Successfully installed appengine-tools-0.0.6 Successfully installed google-appengine-0.0.6 5 gems installed Installing ri documentation for appengine-rack-0.0.4... Installing ri documentation for appengine-jruby-jars-0.0.6... Installing ri documentation for appengine-sdk-1.2.6... Installing ri documentation for appengine-tools-0.0.6... Installing ri documentation for google-appengine-0.0.6... Installing RDoc documentation for appengine-rack-0.0.4... Installing RDoc documentation for appengine-jruby-jars-0.0.6... Installing RDoc documentation for appengine-sdk-1.2.6... Installing RDoc documentation for appengine-tools-0.0.6... Installing RDoc documentation for google-appengine-0.0.6... 8 Wednesday, November 25, 2009
  9. 9. App Engine Gems • Development Gems – appengine-rack – appengine-tools dev_appserver.rb & appcfg.rb – appengine-sdk – appengine-jruby-jars • Runtime Gems – appengine-rack – dm-appengine – appengine-apis 9 Wednesday, November 25, 2009
  10. 10. Dev AppServer • Customized Jetty server • 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 10 Wednesday, November 25, 2009
  11. 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 11 Wednesday, November 25, 2009
  12. 12. App Engine JRuby APIs • AppEngine::Users • AppEngine::Datastore • AppEngine::Memcache • AppEngine::Mail • AppEngine::URLFetch • AppEngine::Images • AppEngine::Logger • AppEngine::Testing • AppEngine::XMPP • AppEngine::Labs::TaskQueue 12 Wednesday, November 25, 2009
  13. 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 13 Wednesday, November 25, 2009
  14. 14. XMPP API 14 Wednesday, November 25, 2009
  15. 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) 15 Wednesday, November 25, 2009
  16. 16. URL Fetch API • Drop-in replacement for Net::HTTP AppEngine::URLFetch.fetch(url, options={}) :method :payload :headers :allow_truncated :follow_redirects :deadline 16 Wednesday, November 25, 2009
  17. 17. Small & Modular Frameworks • Rack • Sinatra • Merb/Rails3* • Duby * Currently unreleased 17 Wednesday, November 25, 2009
  18. 18. DataMapper Finders # 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 ]) 18 Wednesday, November 25, 2009
  19. 19. DataMapper Associations • has n, has 1 • belongs_to, many_to_one class Post include DataMapper::Resource property :id, Serial property :message, Text has n, :comments end class Comment include DataMapper::Resource property :id, Serial property :message, Text belongs_to :post end 19 Wednesday, November 25, 2009
  20. 20. Demo Wednesday, November 25, 2009
  21. 21. Resources • John Woodell, woodie@google.com • Google App Engine for JRuby – http://code.google.com/p/appengine-jruby/ • Google Group – http://groups.google.com/group/appengine-jruby • Blog: JRuby on App Engine Blog – http://jruby-appengine.blogspot.com/ 21 Wednesday, November 25, 2009
  22. 22. Wednesday, November 25, 2009

×