Sunday, May 9, 2010
JRuby on App Engine
            Run Ruby apps on Google Servers,
            with access to first-class Java APIs
        ...
Google App Engine
              3



Sunday, May 9, 2010
Key Features
            • No need to install or maintain your own stack
            • Use Google scalable services via st...
Key Limitations
            • No native code
            • No threads or sockets
            • No writing to the filesyste...
Dev AppServer
            • Local implementation of services
              – LRU memcache
              – Disk-backed data...
Deployment
            • Your app lives at
              – <app_id>.appspot.com, or
              – Custom domain with Goo...
Quotas and Billing
                      Resource      Provided Free      Additional Cost
                      CPU time  ...
App Engine Product Roadmap
            • SSL for third-party domains
            • Background servers capable of running f...
JRuby on App Engine
             10



Sunday, May 9, 2010
Rails Deployment History
           • 2004 - FastCGI on Apache or Lighttpd
                      “a rocket that sometimes ...
Benefits of JRuby
            • Outperforms MRI in many cases... 2x to 10x
            • Gem extensions written in Java (n...
App Engine JRuby Milestones
            • 2009-04-08   @olabini publishes blog post on YARBL
            • 2009-05-06   Ra...
Current Issues with JRuby on App Engine
            • Several seconds to “spin-up” a new JRuby instance
            • Some...
Install it Now

                      sudo gem install google-appengine



                        Everything you need ins...
App Engine Gems
            • Development Gems
              – appengine-sdk
              – appengine-jruby-jars
        ...
App Engine JRuby APIs
            • AppEngine::Users
            • AppEngine::Datastore
            • AppEngine::Memcache
...
Users API
            • Existing User Account
            • Restrict your app to a domain


           map '/src' do
     ...
Datastore API + DataMapper
             # Comparisons you’d expect
             Zoo.first(:name => 'Galveston')

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


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

   ...
Resources
            • John Woodell, @johnwoodell
            • Blog
                  – http://jruby-appengine.blogspot....
Sunday, May 9, 2010
Upcoming SlideShare
Loading in …5
×

Red Dirt Ruby Conference

1,483
-1

Published on

JRuby on App Engine

Run Ruby apps on Google Servers,
with access to first-class Java APIs

2010-05-06

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

No Downloads
Views
Total Views
1,483
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
0
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Red Dirt Ruby Conference

  1. 1. Sunday, May 9, 2010
  2. 2. JRuby on App Engine Run Ruby apps on Google Servers, with access to first-class Java APIs John Woodell May 6, 2010 2 Sunday, May 9, 2010
  3. 3. Google App Engine 3 Sunday, May 9, 2010
  4. 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 Sunday, May 9, 2010
  5. 5. Key Limitations • No native code • No threads or sockets • No writing to the filesystem • No relational database • No more than 30 seconds per request 5 Sunday, May 9, 2010
  6. 6. 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 6 Sunday, May 9, 2010
  7. 7. 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 7 Sunday, May 9, 2010
  8. 8. 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 8 Sunday, May 9, 2010
  9. 9. 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 9 Sunday, May 9, 2010
  10. 10. JRuby on App Engine 10 Sunday, May 9, 2010
  11. 11. Rails Deployment History • 2004 - FastCGI on Apache or Lighttpd “a rocket that sometimes blows up in strange ways” • 2006 - Mongrel clusters behind Apache mod_proxy “high throughput, but requires multiple moving parts” • 2008 - Phusion Passenger on Apache “simply upload files, rack-based, REE/COW” • 2010 - Running in a servlet container with JRuby-Rack “powerful/portable/scalable, rack-based, JRuby” 11 Sunday, May 9, 2010
  12. 12. Benefits of JRuby • Outperforms MRI in many cases... 2x to 10x • Gem extensions written in Java (no more segfaults) • A wealth of integration options and first-class Java APIs • Spin-up new instances quickly using Duby (or Java) servlets 12 Sunday, May 9, 2010
  13. 13. App Engine JRuby Milestones • 2009-04-08 @olabini publishes blog post on YARBL • 2009-05-06 RailsConf • 2009-11-02 0.0.5 bundler, precompilation, Duby • 2009-11-20 RubyConf • 2009-12-02 0.0.6 Rails 3.0.pre primer & image demos • 2009-12-27 @urekat publishes Rails 2.3.5 patches • 2010-01-21 0.0.8 Rails 2.3.5 Primer for DM & TinyDS • 2010-01-26 0.0.9 Mechanize and Hpricot demos • 2010-02-19 @carlhuda publishes bundler08 • 2010-02-27 0.0.10 ActionMailer demos • 2010-04-08 0.0.11 deferred dispatcher (early look) • 2010-05-06 0.0.12 JRuby 1.5 & OpenSSL 0.7 13 Sunday, May 9, 2010
  14. 14. Current Issues with JRuby on App Engine • Several seconds to “spin-up” a new JRuby instance • Some gems may need their extensions ported to Java • Not officially supported , but you have all that you need + 14 Sunday, May 9, 2010
  15. 15. Install it Now sudo gem install google-appengine Everything you need installs as gems 15 Sunday, May 9, 2010
  16. 16. App Engine Gems • Development Gems – appengine-sdk – appengine-jruby-jars – appengine-rack – appengine-tools . . . dev_appserver.rb & appcfg.rb • Runtime Gems – appengine-rack . . . . rack & jruby-rack – appengine-apis • Related Gems – dm-appengine – rails_appengine – rails_dm_datastore – rails_tiny_ds 16 Sunday, May 9, 2010
  17. 17. App Engine JRuby APIs • AppEngine::Users • AppEngine::Datastore • AppEngine::Memcache • AppEngine::Mail • AppEngine::URLFetch • AppEngine::Images • AppEngine::Logger • AppEngine::XMPP • AppEngine::Labs::TaskQueue 17 Sunday, May 9, 2010
  18. 18. 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 18 Sunday, May 9, 2010
  19. 19. 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 ]) 19 Sunday, May 9, 2010
  20. 20. 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) 20 Sunday, May 9, 2010
  21. 21. URL Fetch API • Drop-in replacement for Net::HTTP AppEngine::URLFetch.fetch(url, options={}) :method :payload :headers :allow_truncated :follow_redirects :deadline 21 Sunday, May 9, 2010
  22. 22. Resources • John Woodell, @johnwoodell • Blog – http://jruby-appengine.blogspot.com/ • Code Site – http://code.google.com/p/appengine-jruby/ • Google Group – http://groups.google.com/group/appengine-jruby 22 Sunday, May 9, 2010
  23. 23. Sunday, May 9, 2010

×